/* NCA – Estil compacte, plantilla clara */

:root {
  --hdr: #1a2332;
  --bg: #f3f5f8;
  --card-bg: #fff;
  --brd: #dde2e8;
  --txt: #2c3e50;
  --muted: #7f8c8d;
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 12px;
}

/* ── Header ─────────────────────────────────── */
.header {
  background: var(--hdr);
  color: #fff;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hdr-logo { font-weight: 700; font-size: 14px; letter-spacing: 1px; }
.hdr-sub  { font-size: 11px; opacity: .75; }
.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hdr-lbl { font-size: 11px; opacity: .8; }
.dd-dept { width: 260px; font-size: 11px; color: #333; }
.dd-dept .Select-value-label { color: #333 !important; }
.dd-dept .Select-control { background-color: #fff !important; }
.dd-dept .VirtualizedSelectOption { color: #333; }
.dd-dept .Select-placeholder { color: #999; }

/* ── Main ───────────────────────────────────── */
.main {
  max-width: 1350px;
  margin: 0 auto;
  padding: 10px 16px;
}

/* ── Resum comparatiu ───────────────────────── */
.resum-row { margin-bottom: 10px; }
.resum-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1.5fr;
  gap: 10px;
}
.bloc-resum {
  background: var(--card-bg);
  border: 1px solid var(--brd);
  border-radius: 6px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}
.bloc-titol {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--brd);
  padding-bottom: 4px;
  margin-bottom: 2px;
}
.bloc-titol-text {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
.btn-segmentar {
  font-size: 9px;
  padding: 2px 8px;
  border: 1px solid var(--brd);
  border-radius: 3px;
  background: #f5f7fa;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.btn-segmentar:hover {
  background: #e8ecf0;
  color: var(--txt);
}
.bloc-titol-btns {
  display: flex;
  gap: 4px;
}
.btn-reset-sim {
  font-size: 9px;
  padding: 2px 8px;
  border: 1px solid #e67e22;
  border-radius: 3px;
  background: #fef5ec;
  color: #e67e22;
  cursor: pointer;
  font-family: inherit;
}
.btn-reset-sim:hover {
  background: #fdebd0;
}

/* Cards */
.card {
  padding: 5px 6px;
  border-radius: 4px;
  background: #f9fafb;
  border-left: 3px solid transparent;
}
.c-val { font-size: 13px; font-weight: 700; color: var(--txt); }
.c-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.c-sub { font-size: 10px; color: var(--muted); margin-top: 1px; }
.c-finals { font-size: 11px; color: #1f6feb; font-weight: 600; }

/* ── Frases informatives ────────────────────── */
.frase-info {
  grid-column: 1 / -1;
  font-size: 10px;
  color: #555;
  background: #f0f4f8;
  padding: 4px 8px;
  border-radius: 3px;
  border-left: 2px solid #95a5a6;
  line-height: 1.4;
}

/* ── Simulació ──────────────────────────────── */
.sim-details { margin-bottom: 8px; }
.section-toggle {
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  color: var(--txt);
}
.sim-panel { padding: 4px 0; }
.sim-help { font-size: 10px; color: var(--muted); margin-bottom: 6px; }

/* ── Separador ──────────────────────────────── */
.sep { border: none; border-top: 1px solid var(--brd); margin: 6px 0; }

/* ── Detall ─────────────────────────────────── */
.detall-section { margin-top: 4px; }
.det-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.det-lbl { font-weight: 600; font-size: 11px; }
.radio-sit label {
  font-size: 11px;
  margin-right: 8px;
}

/* ── Correccions ────────────────────────────── */
.correccions-bloc {
  margin-top: 10px;
  padding: 8px;
  background: #fef9f0;
  border: 1px solid #f0d9b5;
  border-radius: 6px;
}
.corr-titol {
  font-size: 11px;
  font-weight: 600;
  margin: 6px 0 4px 0;
  color: #c0392b;
}

/* ── Modal segmentació ──────────────────────── */
.modal-flotant {
  position: fixed;
  z-index: 1000;
  overflow: hidden;
  min-width: 640px;
  min-height: 320px;
  max-width: 96vw;
  max-height: 92vh;
  background: #fff;
  border: 1px solid var(--brd);
  border-radius: 8px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.28);
}
.canvas-body {
  height: calc(100% - 42px);
  overflow: auto;
}
.modal-flotant .modal-contingut {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.28);
  width: 620px;
  max-width: 85vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--brd);
}
.modal-pos-0 { top: 60px;  left: 30px; }
.modal-pos-1 { top: 90px;  left: 220px; }
.modal-pos-2 { top: 120px; right: 30px; }
.modal-seg { z-index: 2000; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--brd);
  background: #f5f7fa;
  cursor: grab;
  user-select: none;
}

.modal-titol {
  font-weight: 700;
  font-size: 13px;
  color: var(--txt);
}

.modal-tancar {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-tancar:hover { background: #eee; }

.modal-minimitzar {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.modal-minimitzar:hover { background: #eee; }

.modal-maximitzar {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.modal-maximitzar:hover { background: #eee; }

.resize-handle {
  position: absolute;
  z-index: 1002;
  background: transparent;
}
.resize-e { top: 8px; right: -3px; width: 8px; height: calc(100% - 16px); cursor: ew-resize; }
.resize-w { top: 8px; left: -3px; width: 8px; height: calc(100% - 16px); cursor: ew-resize; }
.resize-s { left: 8px; bottom: -3px; width: calc(100% - 16px); height: 8px; cursor: ns-resize; }
.resize-n { left: 8px; top: -3px; width: calc(100% - 16px); height: 8px; cursor: ns-resize; }
.resize-ne { top: -3px; right: -3px; width: 12px; height: 12px; cursor: nesw-resize; }
.resize-se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: nwse-resize; }
.resize-sw { bottom: -3px; left: -3px; width: 12px; height: 12px; cursor: nesw-resize; }
.resize-nw { top: -3px; left: -3px; width: 12px; height: 12px; cursor: nwse-resize; }

.modal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--brd);
}

.modal-cos {
  padding: 10px 16px;
  overflow-y: auto;
  flex: 1;
}

/* ── Resum wrapper: botons Segmentar + toggle ─ */
.resum-wrapper {
  position: relative;
}

/* Botó Segmentar – Actual (1r bloc) */
.seg-actual {
  position: absolute;
  top: 5px;
  right: calc(75% + 12px);
  z-index: 5;
}

/* Bloc NCA: toggle + segmentar junts */
.toggle-nca-wrap {
  position: absolute;
  top: 4px;
  left: calc(25% + 8px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.toggle-nca-wrap .radio-sit label {
  font-size: 10px;
  padding: 1px 6px;
  margin-right: 2px;
  border: 1px solid var(--brd);
  border-radius: 3px;
  cursor: pointer;
  background: #f5f5f5;
  color: var(--muted);
}

/* Botó Segmentar – Simulació (3r bloc) */
.seg-sim {
  position: absolute;
  top: 5px;
  right: 8px;
  z-index: 5;
}
.seg-export {
  position: absolute;
  top: 5px;
  right: 110px;
  z-index: 5;
}

/* ── Taules DataTable override ──────────────── */
.dash-table-container {
  font-size: 11px !important;
}
