:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #dde1e7;
  --primary: #1a56db;
  --primary-hover: #1747c8;
  --primary-light: #e8f0fe;
  --danger: #dc2626;
  --text: #111827;
  --text-muted: #6b7280;
  --header-bg: #e2e8f0;
  --header-text: #1e293b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 24px;
  height: 56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.header-left {
  display: flex;
  align-items: center;
}
.header-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
}
.header-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  color: var(--header-text);
  text-transform: uppercase;
  margin: 0;
}

/* ── Screens ── */
#app { max-width: 1250px; margin: 0 auto; padding: 12px 16px; }
.screen { display: none; }
.screen.active { display: block; }
#screen-editor.screen.active { display: flex; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ── Buttons ── */
button { cursor: pointer; border: none; font-size: 14px; font-family: inherit; }

.btn-back {
  background: none;
  color: var(--primary);
  padding: 6px 0;
  font-weight: 500;
}
.btn-back:hover { text-decoration: underline; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
  padding: 7px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  border: 1px solid #c7d9fc;
}
.btn-secondary:hover { background: #d2e3fd; }

.btn-icon {
  background: none;
  color: var(--header-text);
  font-size: 20px;
  padding: 6px 8px;
  border-radius: var(--radius);
}
.btn-icon:hover { background: rgba(255,255,255,.1); }

.btn-full { width: 100%; margin-top: 8px; padding: 12px; font-size: 15px; }

.btn-danger {
  background: none;
  color: var(--danger);
  padding: 2px 6px;
  font-size: 16px;
  border-radius: 4px;
}
.btn-danger:hover { background: #fee2e2; }

/* ── Client grid ── */
#screen-clientes h2 { font-size: 20px; margin-bottom: 20px; }

.client-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 20px;
}

.client-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.client-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(26,86,219,.15);
  transform: translateY(-2px);
}
.client-card .client-count {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Lista palets ── */
.lista-header {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}
.lista-header input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
}
.lista-header input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.12); }

#lista-palets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1024px) {
  #lista-palets { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  #lista-palets { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  #lista-palets { grid-template-columns: 1fr; }
}

.palet-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  min-height: 120px;
}
.palet-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.palet-item-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.palet-item-dims {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.palet-item-tipo {
  font-size: 12px;
  color: var(--text-muted);
}

.palet-item-precio {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  text-align: left;
  width: 100%;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 8px;
}
.palet-item-precio small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.badge-jaula { background: #dbeafe; color: #1d4ed8; }
.badge-jaula-ciega { background: #fee2e2; color: #b91c1c; }
.badge-tapa { background: #ede9fe; color: #6d28d9; }
.badge-reforzado { background: #fef3c7; color: #b45309; }
.badge-ciego { background: #dcfce7; color: #15803d; }
.badge-ciego-r { background: #fce7f3; color: #9d174d; }
.badge-normal { background: #f1f5f9; color: #475569; }
/* ── Editor ── */
#screen-editor {
  height: calc(100vh - 120px);
  flex-direction: column;
  min-height: 0;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.75fr;
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  height: 100%;
}
@media (max-width: 1100px) {
  .editor-grid {
    grid-template-columns: 1fr 1fr;
  }
  .editor-right {
    grid-column: span 2;
    display: flex;
    flex-direction: row;
    height: auto;
    gap: 16px;
  }
  .editor-right .card {
    flex: 1;
  }
}
@media (max-width: 768px) { 
  #screen-editor { height: auto; }
  .editor-grid { grid-template-columns: 1fr; height: auto; } 
  .editor-right {
    grid-column: span 1;
    flex-direction: column;
  }
}



.editor-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  min-height: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.card h3 { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

.card-diagrama {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#editor-viz-wrap {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-materiales {
  height: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.table-wrap {
  height: auto;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fdfdfd;
}

#tabla-materiales {
  margin-bottom: 0;
}

#tabla-materiales th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 10;
  box-shadow: 0 1px 0 var(--border);
}

.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.form-row label { min-width: 140px; color: var(--text-muted); font-size: 13px; }
.form-row input, .form-row select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  background: #fff;
}
.form-row input:focus, .form-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.dims { flex-wrap: wrap; }
.dims label { min-width: 80px; }
.dims input { min-width: 80px; max-width: 100px; }
#label-alto, #dim-alto { transition: opacity .2s; }
#label-alto.hidden, #dim-alto.hidden { opacity: 0; pointer-events: none; }

/* ── Tabla materiales ── */
#tabla-materiales {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 13px;
}
#tabla-materiales th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
}
#tabla-materiales td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
}
#tabla-materiales td input {
  width: 100%;
  padding: 5px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  text-align: right;
  outline: none;
}
#tabla-materiales td input:focus { border-color: var(--primary); }
.td-subtotal { font-weight: 600; text-align: right; color: var(--text-muted); white-space: nowrap; }
.td-precio input { background: #fff; }
.td-precio input:not(:placeholder-shown) { border-color: #f59e0b; background: #fffbeb; }

.th-parte { width: 110px; }
.td-parte { width: 110px; }
#tabla-materiales th:nth-child(2), #tabla-materiales td:nth-child(2) { width: 42px; }
#tabla-materiales th:nth-child(3), #tabla-materiales td:nth-child(3) { width: 45px; }
#tabla-materiales th:nth-child(4), #tabla-materiales td:nth-child(4) { width: 45px; }
#tabla-materiales th:nth-child(5), #tabla-materiales td:nth-child(5) { width: 45px; }
#tabla-materiales th:nth-child(6), #tabla-materiales td:nth-child(6) { width: 55px; }
#tabla-materiales th:nth-child(7), #tabla-materiales td:nth-child(7) { width: 45px; }
#tabla-materiales th:nth-child(8), #tabla-materiales td:nth-child(8) { width: 75px; }
#tabla-materiales th:nth-child(9), #tabla-materiales td:nth-child(9) { width: 32px; }

.sel-parte {
  width: 100%;
  padding: 4px 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  background: #fff;
  outline: none;
  cursor: pointer;
}
.sel-parte:focus { border-color: var(--primary); }

#tbody-materiales tr.row-highlight { background: #dbeafe; }
#tbody-materiales tr.row-highlight td { border-bottom-color: #93c5fd; }

/* ── Editor inline diagram ── */
.card-diagrama { padding: 14px 16px; }
.card-diagrama h3 { margin-bottom: 10px; }
.card-diagrama .palet-viz-svg { display: block; width: 100%; }

/* ── Resumen ── */
.resumen-linea {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.resumen-linea:last-of-type { border-bottom: none; }
.resumen-linea.subtotal { font-weight: 600; border-top: 2px solid var(--border); margin-top: 4px; }
.resumen-linea.descuento { color: var(--text-muted); font-size: 13px; }
.resumen-linea.total { font-size: 18px; font-weight: 700; color: var(--primary); border-top: 2px solid var(--primary); margin-top: 4px; padding-top: 10px; }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 28px 32px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h2 { font-size: 18px; }
.modal-header .btn-icon { color: var(--text-muted); font-size: 18px; }
.modal-header .btn-icon:hover { background: var(--bg); }
.modal-footer { margin-top: 20px; display: flex; justify-content: flex-end; }

/* ── Header actions ── */
.header-actions { display: flex; justify-content: flex-end; gap: 4px; }

/* ── Per-pallet overrides ── */
.overrides-section {
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.override-label-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 8px;
}
.override-label-title span { font-weight: 400; text-transform: none; letter-spacing: 0; }
.overrides-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ov-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.input-override {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}
.input-override:focus { border-color: var(--primary); }
.input-override:not(:placeholder-shown) {
  border-color: #f59e0b;
  background: #fffbeb;
}

/* ── Viz modal ── */
.modal-box-wide {
  width: 860px;
  max-width: 96vw;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.viz-tipo-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.viz-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.viz-tab:hover { background: var(--primary-light); border-color: var(--primary); }
.viz-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.viz-content {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 700px) { .viz-content { grid-template-columns: 1fr; } }

.palet-viz-svg { display: block; width: 100%; }
.viz-part { transition: opacity .12s; cursor: pointer; }
.viz-part.viz-hover { opacity: 0.65; }

.viz-legend h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: .4px; margin-bottom: 12px; }
.legend-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  transition: background .12s;
}
.legend-item.legend-active { background: var(--primary-light); }
.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1px solid rgba(0,0,0,.15);
}
.legend-item strong { font-size: 13px; display: block; margin-bottom: 2px; }
.legend-item p { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.4; }

.viz-tooltip {
  position: absolute;
  background: #1a1a2e;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
  z-index: 300;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.viz-tooltip strong { display: block; margin-bottom: 3px; font-size: 13px; }
.viz-tooltip span { font-size: 12px; opacity: .85; line-height: 1.4; }
.viz-tooltip.hidden { display: none; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.empty-state p { font-size: 15px; margin-bottom: 4px; }
.empty-state small { font-size: 13px; }

/* ── Client Cards with Logos ── */
.client-logo-wrap {
  height: 60px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.client-logo {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}
.client-logo-fallback {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-transform: uppercase;
}

/* Override client-card to layout components vertically */
.client-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}

/* ── Full width editor dashboard ── */
body.editor-active #app {
  max-width: 100%;
  padding-left: 24px;
  padding-right: 24px;
}

/* ── Zoom Controls ── */
.viz-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ── Dimensions Overlay ── */
.viz-dims-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}
.viz-dim-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  line-height: 1.4;
}
.viz-dim-item span:first-child {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.dim-color-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.viz-dim-item span:last-child {
  font-weight: 700;
  color: var(--text);
}

.viz-zoom-controls {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 20;
}

.btn-zoom {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  user-select: none;
}
.btn-zoom:hover {
  background: var(--surface);
  border-color: var(--primary);
  transform: scale(1.05);
}
.btn-zoom:active {
  transform: scale(0.95);
}

/* ── Extras Integrated Table ── */
.tabla-extras {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fcfcfc;
  overflow: hidden;
  flex-shrink: 0;
}

.tabla-extras th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  background: #f8fafc;
}

.tabla-extras td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tabla-extras tr:last-child td {
  border-bottom: none;
}

.extra-info-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.extra-info-cell span {
  font-weight: 500;
  color: var(--text);
}

.extra-info-cell input {
  width: 70px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
  outline: none;
  background: #fff;
}
.extra-info-cell input:focus {
  border-color: var(--primary);
}

/* ── Integrated Diagram Controls ── */
.diagram-controls {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.diagram-controls .form-row {
  margin-bottom: 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;
}
.diagram-controls .select-row label {
  min-width: 50px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}
.diagram-controls .select-row select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  background: #fff;
}
.diagram-controls .select-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.dims-row {
  display: flex;
  gap: 8px;
  width: 100%;
}
.dim-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.dim-field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.dim-field input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}
.dim-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.dim-field.hidden {
  display: none !important;
}

/* ── Compact Materials Table for narrow cols ── */
#tabla-materiales th {
  padding: 5px 6px;
  font-size: 11px;
}
#tabla-materiales td {
  padding: 4px 4px;
}
#tabla-materiales td input {
  padding: 4px 6px;
  font-size: 12px;
}
.sel-parte {
  padding: 3px 2px;
  font-size: 11px;
}

/* ── Text Settings Button ── */
.btn-text-settings {
  background: rgba(0, 0, 0, 0.05);
  color: var(--header-text);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  border: 1px solid rgba(0, 0, 0, 0.1);
  outline: none;
  cursor: pointer;
}
.btn-text-settings:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}
.btn-text-settings:active {
  transform: translateY(0);
}

/* ── General Utility ── */
.hidden {
  display: none !important;
}

/* ── Custom Radio Buttons (Uiverse.io LilaRest) ── */
.tipo-selector-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

/* From Uiverse.io by 00Kubi */
.radio-inputs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  border-radius: 0.5rem;
  background-color: #eee;
  box-sizing: border-box;
  box-shadow: 0 0 0px 1px rgba(0, 0, 0, 0.06);
  padding: 0.25rem;
  width: 100%;
  font-size: 14px;
}

.radio-inputs .radio {
  flex: 1 1 auto;
  text-align: center;
}

.radio-inputs .radio input {
  display: none;
}

.radio-inputs .radio .name {
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: none;
  padding: 0.5rem 0;
  color: rgba(51, 65, 85, 1);
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.radio-inputs .radio input:checked + .name {
  background-color: #fff;
  font-weight: 600;
}

/* Hover effect */
.radio-inputs .radio:hover .name {
  background-color: rgba(255, 255, 255, 0.5);
}

/* Animation */
.radio-inputs .radio input:checked + .name {
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  animation: select 0.3s ease;
}

@keyframes select {
  0% {
    transform: scale(0.95);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Particles */
.radio-inputs .radio input:checked + .name::before,
.radio-inputs .radio input:checked + .name::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #3b82f6;
  opacity: 0;
  animation: particles 0.5s ease forwards;
}

.radio-inputs .radio input:checked + .name::before {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
}

.radio-inputs .radio input:checked + .name::after {
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes particles {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(0);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(var(--direction));
  }
}

.radio-inputs .radio input:checked + .name::before {
  --direction: -10px;
}

.radio-inputs .radio input:checked + .name::after {
  --direction: 10px;
}

/* ── Custom Checkboxes (Horizontal) ── */
.checkbox-group {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 6px;
}

.custom-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.3s;
}

.custom-checkbox input[type="checkbox"] {
  display: none;
}

.custom-checkbox .checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  transition: background-color 0.3s, border-color 0.3s, transform 0.3s;
  transform-style: preserve-3d;
  flex-shrink: 0;
  background: #fff;
}

.custom-checkbox .checkmark::before {
  content: "\2713";
  font-size: 12px;
  font-weight: bold;
  color: transparent;
  transition: color 0.3s, transform 0.3s;
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.08) rotateZ(360deg) rotateY(360deg);
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark::before {
  color: #fff;
}

.custom-checkbox:hover {
  color: var(--text);
}

.custom-checkbox:hover .checkmark {
  border-color: var(--primary);
  background-color: #f8fafc;
  transform: scale(1.04);
}

.custom-checkbox input[type="checkbox"]:focus + .checkmark {
  box-shadow: 0 0 0 3px rgba(26,86,219,0.15);
  outline: none;
}

.custom-checkbox .checkmark,
.custom-checkbox input[type="checkbox"]:checked + .checkmark {
  transition: background-color 0.6s, border-color 0.6s, color 0.6s, transform 0.3s;
}

