/* ──────────────────────────────
   TABLA
────────────────────────────── */
.table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead { border-bottom: 1px solid var(--color-border); }

th {
  background: #fafbfc;
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--color-subtle);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .65px;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-text);
}

tr:last-child td { border-bottom: none; }

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

.td-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}

/* ──────────────────────────────
   MODAL
────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 500px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.1px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--color-subtle);
  line-height: 1;
  padding: 0 2px;
  transition: color .15s;
}
.modal-close:hover { color: var(--color-text); }

.modal-body   { padding: 22px 24px; }
.modal-footer {
  padding: 14px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--color-border);
  background: #fafbfc;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ──────────────────────────────
   FORM GRID
────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.form-row .span2 { grid-column: span 2; }

/* ──────────────────────────────
   STAT CARDS
────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--gold);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--color-text);
  letter-spacing: -.5px;
}

/* ──────────────────────────────
   EMPTY STATE
────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--color-subtle);
  font-size: 13.5px;
}
.empty-state p { margin-top: 6px; font-size: 12.5px; }

/* ──────────────────────────────
   FILTERS BAR
────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filters-bar label {
  margin: 0;
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 500;
}

.filters-bar select { width: auto; }

/* ── Formulari: capçalera de secció ── */
.form-section {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .65px;
  color: var(--color-muted);
  padding-bottom: 7px;
  border-bottom: 1px solid var(--color-border);
  margin: 20px 0 2px;
  grid-column: span 2;
}
.form-section:first-child { margin-top: 0; }

/* ── Checkboxes en grup ── */
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  grid-column: span 2;
  padding: 4px 0;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 400;
  font-size: 13px;
  margin: 0;
  cursor: pointer;
  color: var(--color-text);
}
.check-label input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Fitxa de detall ── */
.fitxa-link {
  cursor: pointer;
  color: var(--color-text);
  text-decoration: none;
}
.fitxa-link:hover strong {
  color: var(--gold-dark);
  text-decoration: underline;
}

.fitxa-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  font-size: 13px;
  margin: 0;
}
.fitxa-dl dt {
  color: var(--color-muted);
  font-weight: 500;
  white-space: nowrap;
}
.fitxa-dl dd {
  margin: 0;
  color: var(--color-text);
  word-break: break-word;
}

/* ── Panel / Dashboard ── */
.avís-list { list-style: none; }
.avís-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.avís-item:last-child { border-bottom: none; }
.avís-name { font-weight: 600; }
.avís-meta { color: var(--color-muted); font-size: 12px; }

.panel-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.panel-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--color-muted);
  margin-bottom: 12px;
}
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.avís-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.avís-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-left: 10px;
}
.avís-empty {
  color: var(--color-subtle, var(--color-muted));
  font-size: 13px;
  margin: 0;
}
.avís-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: var(--color-error, #dc2626);
  color: #fff;
  vertical-align: middle;
  margin-left: 4px;
}
.avís-badge--ok {
  background: var(--color-success, #16a34a);
}

.btn-xs {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.6;
}
.btn-action {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-action:hover { opacity: .88; }
.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ──────────────────────────────
   PAGAMENTS VIEW
────────────────────────────── */
.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.resum-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0 32px;
  padding: 14px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}
.resum-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}
.resum-item.resum-sep {
  border-left: 1px solid var(--color-border);
  padding-left: 32px;
  margin-left: 8px;
}
.resum-label {
  font-size: 11px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--color-text);
}

/* ──────────────────────────────
   CSV IMPORT
────────────────────────────── */
.file-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--gold);
  background: var(--gold-light);
}
