:root {
  --azul: #0057ff;
  --azul2: #0057ff;
  --celeste: #edf5ff;
  --gris: #6b7280;
  --fondo: #f5f5f7;
  --texto: #111827;
  --borde: #dfe5ee;
  --verde: #078348;
  --rojo: #ff2d2d;
  --shadow: 0 18px 46px rgba(15, 23, 42, .10);
  --soft-shadow: 0 10px 26px rgba(15, 23, 42, .065);
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at 0 0, rgba(0, 87, 255, .10), transparent 26rem),
    radial-gradient(circle at 100% 5%, rgba(124, 58, 237, .07), transparent 24rem),
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 52%, #eef1f6 100%);
  color: var(--texto);
}

.wrap {
  width: calc(100% - 24px);
  max-width: none;
  margin: 0 auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero { display: none !important; }

/* Barra superior estilo Apple */
.apple-appbar {
  min-height: 84px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  display: grid;
  grid-template-columns: minmax(330px, 1fr) auto;
  gap: 20px;
  align-items: center;
}

.apple-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.apple-brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  background: linear-gradient(145deg, #75a7ff 0%, #1463ff 58%, #4338ca 100%);
  box-shadow: 0 14px 28px rgba(0, 87, 255, .28), inset 0 1px 1px rgba(255, 255, 255, .45);
}

.apple-brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -.055em;
  font-weight: 850;
}

.apple-brand p {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 16px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: -.02em;
}

.apple-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
}

button {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.apple-action-main,
.apple-action,
.apple-action-exit {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -.02em;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}

.apple-action-main {
  min-height: 42px;
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
}

.apple-action-main:hover {
  transform: translateY(-1px);
}

.apple-action {
  color: #fff;
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
  border: 1px solid rgba(226, 232, 240, .8);
  box-shadow: 0 7px 16px rgba(15, 23, 42, .035);
}

.apple-action:hover {
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .07);
}

.apple-action-exit {
  color: #e11d48;
  background: #fff1f2;
  border: 1px solid rgba(225, 29, 72, .08);
}

.apple-action-exit:hover {
  color: #fff;
  background: linear-gradient(180deg, #ff3b30, #e11d48);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(225, 29, 72, .24);
}

/* Layout principal */
.apple-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.apple-left,
.apple-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.apple-left {
  position: sticky;
  top: 12px;
}

/* .card,
.apple-panel {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .96);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
} */

.section-title,
.apple-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0;
}

.section-title h2,
.apple-panel-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -.04em;
  font-weight: 850;
}

.apple-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: 0 0 auto;
}

.icon-blue { color: #0057ff; background: #edf5ff; }
.icon-green { color: #078348; background: #eaf8ef; }
.icon-purple { color: #4c22c9; background: #f1eaff; }

/* Campos */
.field {
  margin-top: 14px;
}

.apple-inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  margin: 0 0 8px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
}

input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--borde);
  border-radius: 11px;
  padding: 0 14px;
  background: rgba(255, 255, 255, .62);
  color: #111827;
  outline: none;
  font-size: 16px;
  letter-spacing: -.02em;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .025);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus {
  background: #fff;
}

.hint {
  margin: 11px 0 0;
  color: #6b7280;
  font-size: 12.5px;
  line-height: 1.35;
}

/* Botones formulario */
.actions,
.apple-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 48px;
  gap: 12px;
  margin-top: 22px;
}

.primary,
.secondary,
.apple-save,
.apple-clear {
  min-height: 45px;
  border-radius: 11px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -.02em;
  background: rgba(255, 255, 255, .70);
  color: #111827;
  border: 1px solid var(--borde);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.secondary:hover,
.apple-save:hover,
.apple-clear:hover,
.apple-pdf:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .07);
}

/* .primary:hover {
  background:#fff;
} */

button.secondary {
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
  color: #fff;
  padding: 7px 15px;
  
}

button.secondary:hover {
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
}


button.secondary.apple-pdf {
  background: #ffff;
}




.primary {
  background: #fff;
  color: #000000;
  border: 1px solid var(--borde);
}

button.primary {
  padding: 7px 15px;
  border: 1px solid var(--borde);
}
.button.primary:hover {
  background: #1677ff;
}


/* Resumen */
.pill {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf5ff;
  color: #0057ff;
  font-weight: 750;
  font-size: 12px;
  white-space: nowrap;
}

.totals,
.apple-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kpi,
.apple-kpi {
  min-height: 92px;
  padding: 14px 15px;
  border-radius: 12px;
  border: 1px solid var(--borde);
  background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(248, 250, 252, .7));
}

.kpi span,
.apple-kpi span {
  display: block;
  color: #374151;
  font-size: 13px;
  font-weight: 610;
  letter-spacing: -.02em;
}

.kpi strong,
.apple-kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: .95;
  font-weight: 800;
  letter-spacing: -.065em;
}

.kpi-green {
  background: linear-gradient(180deg, #f0fdf6, #f8fffb);
  border-color: rgba(7, 131, 72, .13);
}

.kpi-blue {
  background: linear-gradient(180deg, #eef6ff, #fbfdff);
  border-color: rgba(0, 87, 255, .13);
}

.precio-pvp {
  color: #173c8a;
  font-weight: 800;
}

.precio-dist {
  color: #078348 !important;
  font-weight: 800;
}

/* aviso del descuento aplicado - iva */
.iva-warning {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 11px;
  background: #fff8d6;
  border: 2px solid #facc15;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 700;
}

.iva-warning i {
  color: #eab308;
  font-size: 18px;
}

/* Tablas estilo Apple */
/* .apple-table-panel {
  padding: 18px;
  overflow-x: auto;
}

.apple-table-panel .section-title {
  margin-bottom: 20px;
} */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 12px;
}

thead th,
th {
  padding: 0 14px 6px;
  color: #374151;
  font-size: 13px;
  line-height: 1;
  font-weight: 560;
  text-align: right;
  text-transform: none;
  letter-spacing: -.01em;
  white-space: nowrap;
}

thead th:first-child,
th:first-child {
  text-align: center;
  width: 46%;
}

td {
  background: #fff;
  border-top: 1px solid rgba(209, 217, 230, .9);
  border-bottom: 1px solid rgba(209, 217, 230, .9);
  padding: 20px 14px;
  text-align: right;
  vertical-align: middle;
  /* font-size: 15px; */
  letter-spacing: -.02em;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .025);
}

td:first-child {
  position: relative;
  min-height: 78px;
  border-left: 1px solid rgba(209, 217, 230, .9);
  border-radius: 11px 0 0 11px;
  text-align: left;
  padding-left: 24px;
  font-size: 16px;
  color: #111827;
  font-weight: 780;
}

td:last-child {
  border-right: 1px solid rgba(209, 217, 230, .9);
  border-radius: 0 11px 11px 0;
  font-weight: 780;
}

tbody tr:hover td {
  background: #fbfdff;
}

tbody tr:last-child td {
 /*  background: linear-gradient(180deg, #f1f7ff, #edf5ff); */
  /* color: #0048b5; */
  font-weight: 800;
  box-shadow: none;
}

tbody tr:last-child td:first-child {
  text-transform: uppercase;
 /* color: #0048b5; */
  letter-spacing: .01em;
}

/* Login con estética Apple, sin cambiar textos */
.login-screen {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background:
    radial-gradient(circle at 0 0, rgba(0, 87, 255, .10), transparent 26rem),
    linear-gradient(180deg, #fbfbfd, #f5f5f7);
  padding: 20px;
}

.login-card{
  width: 100%;
  max-width: 500px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .96);
  border-radius: 22px;
  padding: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}

.login-card h1 {
  margin: 0 0 18px;
  font-size: 30px;
  letter-spacing: -.055em;
}

.login-card button {
  width: 100%;
  margin-top: 24px;
  min-height: 45px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(180deg, #1677ff, #0057ff);
}

.btn-solicitar {
  width: 100%;
  min-height: 45px;
  border-radius: 11px;
  color: #0057ff;
  background: rgba(255, 255, 255, .70);
  border: 1px solid var(--borde);
  font-weight: 750;
}
input::selection {
    background: transparent;
}

/* Estados, cookies y modales */
.hidden { display: none !important; }

.input-disabled {
  background: #f3f4f6 !important;
  color: #9ca3af !important;
  cursor: not-allowed;
}

.input-error {
  border-color: #ff3b30 !important;
  background: #fff7f7 !important;
}



.error-msg {
  color: #ff3b30;
  font-size: 13px;
  font-weight: 650;
  margin-top: 7px;
}

.toast-exito,
.toast-error {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  min-width: 200px;
  max-width: 320px;
  width: auto;
  padding: 8px 16px;
  border-radius: 10px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.02em;
  text-align: center;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .22);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.toast-exito { background: #078348; }
.toast-error { background: #ff3b30; }



.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  padding: 16px;
  border-radius: 18px;
  color: #fff;
  background: rgba(17, 24, 39, .92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.cookie-content {
  max-width: 1120px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cookie-content p {
  margin: 0;
  color: rgba(255, 255, 255, .85);
  font-size: 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .34);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(18px);
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: auto;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .96);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .24);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-wide {
  max-width: 92vw;
  width: 92vw;
}

.modal-resumen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
  background: #f5f5f7;
  border-radius: 14px;
}

.acciones-usuario {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.pill-verde { background: #34c759; color: #fff; }
.pill-rojo { background: #ff3b30; color: #fff; }

#tabla-presupuestos-admin-container {
  max-height: 440px;
  overflow: auto;
}

#tabla-presupuestos-admin-container table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
/*  background: #fbfbfd; */
}

@media (max-width: 1180px) {
  .apple-layout { grid-template-columns: 340px minmax(0, 1fr); }
  .apple-appbar { grid-template-columns: 1fr; }
  .apple-toolbar { justify-content: flex-start; }
}

@media (max-width: 920px) {
  .wrap { width: calc(100% - 18px); }
  .apple-layout { grid-template-columns: 1fr; }
  .apple-left { position: static; }
}

@media (max-width: 640px) {
  .apple-appbar { padding: 14px; }
  .apple-brand-icon { width: 48px; height: 48px; }
  .apple-brand h1 { font-size: 22px; }
  .apple-brand p { font-size: 14px; }
  .apple-toolbar,
  .apple-toolbar button { width: 100%; }
  .apple-inline-fields,
  .apple-kpi-grid,
  .totals,
  .apple-form-actions { grid-template-columns: 1fr; }
  table { min-width: 720px; }
}

@media print {
  body { background: #fff; }
  .wrap { width: 100%; padding: 0; }
  .apple-appbar,
  .actions,
  .apple-form-actions { display: none; }
  .card,
  .apple-panel { box-shadow: none; border: 1px solid #ddd; }
}


/* Ajuste final aprobado: orden de botones y tarjetas de empleados/centros */
.apple-toolbar { justify-content: flex-end !important; }

.apple-metric-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 14px;
}

.apple-metric-card {
  min-height: 92px;
  padding: 14px 14px 12px;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: rgba(255,255,255,.58);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.65);
}

.apple-metric-card label {
  margin: 0 0 12px;
  font-size: 12px;
  color: #4b5563;
  font-weight: 650;
}

.metric-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.metric-line i {
  font-size: 17px;
  color: #1f2937;
  flex: 0 0 auto;
}

.metric-line input {
  width: 48px !important;
  height: 32px !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #111827 !important;
  font-size: 28px !important;
  line-height: 1 !important;
  font-weight: 520 !important;
  letter-spacing: -.06em !important;
  text-align: center;
}

.metric-line input:focus {
  box-shadow: none !important;
  outline: none !important;
}

/* Spinners visibles en metric-line */
.metric-line input[type="number"]::-webkit-inner-spin-button,
.metric-line input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
  height: 28px;
  cursor: pointer;
}

.metric-line input[type="number"] {
  width: 72px !important;
}

.metric-line span {
  color: #6b7280;
  font-size: 12px;
  font-weight: 560;
}

.apple-reference-field { margin-top: 14px !important; }

@media (max-width: 640px) {
  .apple-metric-cards { grid-template-columns: 1fr; }
}

/* ============================================================
   MODAL CREAR USUARIO + MODAL LISTADO DE PRESUPUESTOS
   Adaptado a la paleta de variables del proyecto (--azul, --borde, --celeste...)
   ============================================================ */

.close-btn-apple {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--borde);
  background: rgba(255, 255, 255, .76);
  color: var(--gris);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .18s ease, transform .18s ease;
}

.close-btn-apple:hover {
  background: #fff;
  transform: translateY(-1px);
}

.btn-cancel-apple {
  min-height: 44px;
  border-radius: 11px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -.02em;
  background: rgba(255, 255, 255, .70);
  border: 1px solid var(--borde);
  color: #111827;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.btn-cancel-apple:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .07);
}

/* ============================================================
   MODAL CREAR USUARIO
   ============================================================ */
.user-modal-apple {
  width: min(560px, 100%);
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .96);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .24);
  overflow: hidden;
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}

.user-modal-apple-header {
  padding: 22px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid rgba(223, 229, 238, .75);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.70));
}

.user-modal-apple-title {
  display: flex;
  gap: 14px;
  align-items: center;
}

.user-modal-apple-title .user-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--azul);
  background: var(--celeste);
  font-size: 20px;
  flex-shrink: 0;
}

.user-modal-apple-title h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -.055em;
  color: #111827;
}

.user-modal-apple-title p {
  margin: 5px 0 0;
  color: var(--gris);
  font-size: 14px;
}

.user-modal-apple-body {
  padding: 22px 24px 24px;
}

.form-grid-apple {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field-apple.full {
  grid-column: 1 / -1;
}

.form-field-apple label {
  display: block;
  margin: 0 0 8px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.form-field-apple input,
.form-field-apple select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 0 13px;
  background: rgba(255, 255, 255, .72);
  color: #111827;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  letter-spacing: -.02em;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.025);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.form-field-apple input:focus,
.form-field-apple select:focus {
  background: #fff;
  border-color: rgba(0, 87, 255, .45);
  box-shadow: 0 0 0 4px rgba(0, 87, 255, .10);
}

.info-card-apple {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--celeste);
  border: 1px solid rgba(0, 87, 255, .10);
  color: var(--azul);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}

.modal-actions-apple {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-create-apple {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -.02em;
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #1677ff 0%, var(--azul) 100%);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.btn-create-apple:hover {
  transform: translateY(-1px);
}

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

/* ============================================================
   MODAL LISTADO DE PRESUPUESTOS
   ============================================================ */
.budget-modal-apple {
  width: fit-content;
  max-width: 96vw;

  height: fit-content;
  max-height: 92vh;

  background: rgba(255,255,255,.93);
  border: 1px solid rgba(255,255,255,.96);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0,0,0,.24);

  display: flex;
  flex-direction: column;
  overflow: hidden;

  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}

.budget-modal-apple-header {
  padding: 22px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid rgba(223, 229, 238, .75);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.72));
  flex-wrap: wrap;
}

.title-apple {
  display: flex;
  gap: 14px;
  align-items: center;
}

.title-icon-apple {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--azul);
  background: var(--celeste);
  font-size: 20px;
  flex-shrink: 0;
}

.title-apple h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -.055em;
  color: #111827;
}

.title-apple p {
  margin: 5px 0 0;
  color: var(--gris);
  font-size: 14px;
}

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

.search-apple {
  height: 40px;
  width: 250px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: var(--gris);
}

.search-apple input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: #111827;
  height: auto !important;
}

.budget-modal-apple-body {
  padding: 18px 22px;
  overflow-y: auto;
  overflow-x: auto;

  max-height: calc(100vh - 140px); /* clave */
}

.summary-strip-apple {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-apple {
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(248,250,252,.72));
  border: 1px solid var(--borde);
  border-radius: 16px;
  padding: 14px;
}

.stat-apple span {
  display: block;
  color: var(--gris);
  font-size: 12px;
  font-weight: 650;
}

.stat-apple strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  letter-spacing: -.055em;
  font-weight: 800;
  color: #111827;
}

.table-scroll {
    max-height: calc(100vh - 200px); 
    overflow: auto; 
}

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

.table-apple thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 999;
}


.table-apple th {
  padding: 0 12px 4px;
  color: var(--gris);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.table-apple th:first-child {
  text-align: left;
}

.table-apple td {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  padding: 15px 12px;
  text-align: right;
  font-size: 14px;
  vertical-align: middle;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .025);
}

.table-apple td:first-child {
  border-left: 1px solid #e5e7eb;
  border-radius: 14px 0 0 14px;
  text-align: left;
}

.table-apple td:last-child {
  border-right: 1px solid #e5e7eb;
  border-radius: 0 14px 14px 0;
}

.td-ref-apple {
  display: flex;
  flex-direction: column;
}

.ref-apple {
  font-weight: 800;
  color: #111827;
}

.sub-apple {
  display: block;
  margin-top: 4px;
  color: var(--gris);
  font-size: 12px;
  font-weight: 500;
}

.price-pvp-apple {
  color: #173c8a;
  font-weight: 800;
}

.price-pvd-apple {
  color: var(--verde);
  font-weight: 800;
}

.badge-apple {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--celeste);
  color: var(--azul);
  font-size: 12px;
  font-weight: 750;
}

.badge-apple-muted {
  background: #f3f4f6;
  color: var(--gris);
}

.row-actions-apple {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-apple {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--borde);
  background: rgba(255, 255, 255, .76);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 750;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn-apple:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}

.btn-apple-primary {
  color: var(--azul);
  background: var(--celeste);
  border-color: rgba(0, 87, 255, .12);
}

.btn-apple-edit {
  color: var(--verde);
  background: #eaf8ef;
  border-color: rgba(7, 131, 72, .12);
}

.budget-modal-apple-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(223, 229, 238, .75);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gris);
  font-size: 13px;
  background: rgba(248, 250, 252, .74);
}

@media (max-width: 760px) {
  .budget-modal-apple-header {
    flex-direction: column;
  }
  .header-actions-apple,
  .search-apple {
    width: 100%;
  }
  .summary-strip-apple {
    grid-template-columns: 1fr 1fr;
  }
}

/* Modal Panel de Control: botones (Crear usuario + cerrar) alineados a la derecha */
#modal-panel-control .section-title .flex {
  margin-left: auto;
}

/* boton guardar presupuesto */
button.primary.apple-save {
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
  color: white;
}

/* boton limpiar datos */
button.secondary.apple-clear {
  background: #afbd30;
  color: white;
}

/* referencia obligatoria */
.asterisco {
  color: red;
  font-weight: bold;
}

/* icono de pdf en rojo */
.apple-pdf .fa-file-pdf {
  color: var(--rojo) !important;
}


/* crear usuario */
.btn-crear {
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
  color: white;
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
}

.btn-crear:hover {
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
}



/* botones en azul */
.apple-action-admin {
    background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%); 
    color: white;
    background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
}

.apple-action-admin:hover {
    background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
    background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
}


/* espacio entre la palabra y el icono */
.apple-action i {
    margin-right: 8px;
}

/* lo mismo en distribuidor */
.primary.apple-save i {
    margin-right: 8px;
}


/* cabecera fija en la tabla del modal de Presupuestos */
/* .budget-modal-apple-body {
  max-height: none;
  overflow: visible;
}

.table-wrap-apple {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 55vh;
}

.table-apple thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
}

.budget-modal-apple {
  width: min(1400px, 96vw);
} */

button{
    white-space: nowrap;
}


/* estilos creando y editando presupuestos */
.cabecera-titulo{
    display: flex;
    align-items: center;
    gap: 12px;
}

.cabecera-titulo h1{
    margin: 0;
}

#modo-badge{
    position: static;
    transform: none;

    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.modo-edicion{
    background: #fff8e1;
    color: #b45309;
    border: 1px solid rgba(180,83,9,.20);
}

#historial-container table thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}

.budget-modal-apple table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* cabeceras fijas (todas las tablas) */
.budget-modal-apple table thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);

  color: #333;
  font-weight: 600;
  text-align: left;

  padding: 12px 10px;
  border-bottom: 1px solid #eaeaea;

  z-index: 10;
}


.budget-modal-apple table tbody td {
  /* padding: 10px; */
  border-bottom: 1px solid #f2f2f2;
}

.budget-modal-apple table tbody tr:hover {
  background: #f9f9f9;
}


#tabla-distribuidores-container {
  max-height: 400px;
  overflow-y: auto;
}

#tabla-distribuidores-container table thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}




#tabla-usuarios-container {
  max-height: 400px;
  overflow-y: auto;
}

#tabla-usuarios-container table thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  text-align: center;
}

.icono-pdf {
    color: #dc3545;
}




/* ── Login ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px 110px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, #eef5ff 0%, transparent 44%),
    radial-gradient(circle at bottom right, #f4f7fb 0%, transparent 46%),
    #edf2f7;
}

.login-screen::before,
.login-screen::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(37, 99, 235, .08);
  filter: blur(2px);
  pointer-events: none;
}

.login-screen::before {
  width: 210px;
  height: 210px;
  top: 70px;
  left: 80px;
}

.login-screen::after {
  width: 280px;
  height: 280px;
  right: 90px;
  bottom: 90px;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border: 1px solid #dfe7f1;
  border-radius: 18px;
  padding: 42px;
  box-shadow:
    0 20px 60px rgba(15, 23, 42, .10),
    0 2px 8px rgba(15, 23, 42, .05);
  animation: aparecer .45s ease;
}

@keyframes aparecer {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

.login-card h1 {
  margin: 0 0 34px;
  text-align: center;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -.03em;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #d6dde8;
  border-radius: 12px;
  padding: 0 14px;
  transition: .18s ease;
}

.input-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}

.input-icon {
  font-size: 17px;
  opacity: .68;
  width: 22px;
  text-align: center;
}

.input-wrap input {
  width: 100%;
  border: none;
  outline: none;
  padding: 14px 0;
  font-size: 15px;
  color: #111827;
}


.input-wrap input::placeholder {
  color: #9ca3af;
}

.input-wrap.input-error {
  border-color: #dc2626 !important;
}

.error-general {
  text-align: center;
  margin-top: 16px;
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  width: min(760px, calc(100% - 32px));
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border: 1px solid #dbe4ef;
  border-radius: 16px;
  box-shadow:
    0 18px 44px rgba(15, 23, 42, .13),
    0 2px 8px rgba(15, 23, 42, .06);
}

.cookie-banner.hidden {
  display: none;
}

.cookie-content {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 20px;
}

.cookie-content p {
  flex: 1;              
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #475569;
}

.cookie-btn {
  flex-shrink: 0;
  margin-left: auto;   

  width: auto !important;
  padding: 11px 22px !important;

  background: #2563eb;
  color: #fff;
  border: 1px solid #2563eb;
  border-radius: 10px;

  font-size: 13px;
  font-weight: 600;
  cursor: pointer;

  transition: .2s ease;
}

.cookie-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}




/* ==========================================================
   ESTILO GLOBAL PARA TODAS LAS TABLAS
   ========================================================== */

table{
    width:100%;
    border-collapse:separate;
    border-spacing:0 6px;
    font-size:14px;
}

thead th{
    position:sticky;
    top:0;
    z-index:20;

    height:40px;
    padding:0 14px;

    background:linear-gradient(180deg,#f1f6ff 0%,#e7f0ff 100%);
    color:#173c8a;

    font-size:11.5px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.03em;
    text-align:left;

    border-top:1px solid #c7d8fb;
    border-bottom:1px solid #c7d8fb;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.8),
        0 6px 14px rgba(15,23,42,.08);
}

thead th:first-child{
    border-left:1px solid #c7d8fb;
    border-radius:12px 0 0 12px;
}

thead th:last-child{
    border-right:1px solid #c7d8fb;
    border-radius:0 12px 12px 0;
}

tbody td{
    /* padding:12px 14px; */
    background:#fff;
    border-top:1px solid #eef2f7;
    border-bottom:1px solid #eef2f7;
    color:#111827;
    vertical-align:middle;
}

tbody td:first-child{
    border-left:1px solid #eef2f7;
    border-radius:12px 0 0 12px;
}

tbody td:last-child{
    border-right:1px solid #eef2f7;
    border-radius:0 12px 12px 0;
}

tbody tr{
    transition:.18s ease;
}

tbody tr:hover td{
    background:#fbfdff;
}

tbody tr:nth-child(even) td{
    background:#fcfdff;
}

tbody tr:nth-child(even):hover td{
    background:#f8fbff;
}

.precio-pvp{
    color:#173c8a;
    font-weight:800;
}

.precio-dist{
    color:#078348;
    font-weight:800;
}

.acciones-usuario{
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:6px;
    white-space:nowrap;
}




/* ==========================================================
   CABECERA GLOBAL DE TODAS LAS TABLAS
   ========================================================== */

table thead th{
    position: sticky;
    top: 0;
    z-index: 10;

    padding: 12px 14px !important;
    height: 42px;

    background: linear-gradient(180deg,#f1f6ff 0%,#e7f0ff 100%) !important;
    color: #173c8a !important;

    font-size: 12px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: center;

    border-bottom: 1px solid #c7d8fb !important;

    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.85),
      0 4px 10px rgba(15,23,42,.08);
}

table thead th{
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: 1px solid #d9e5ff !important;
}

table thead th:last-child{
    border-right: none !important;
}





/****/
.apple-table-panel {
  padding: 30px;
  overflow-x: auto;
}

.apple-table-panel .section-title {
  margin-bottom: 28px;
}

.card,
.apple-panel {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .96);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}



/* quitar el fondo azul al selecionar un usuario desde el login */
.login-screen .input-wrap input:-webkit-autofill,
.login-screen .input-wrap input:-webkit-autofill:hover,
.login-screen .input-wrap input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  box-shadow: 0 0 0px 1000px #ffffff inset !important;
  -webkit-text-fill-color: #111827 !important;
  background-color: transparent !important;
  transition: background-color 5000s ease-in-out 0s;
}

button.primary.btn-small {
  background: linear-gradient(180deg, #1677ff 0%, #0057ff 100%);
  color: #fff;
}


.footer-actions-apple {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}