/* ── Módulos: toolbar, tabla, modal, KPI mini ─────────────────────── */

/* Toolbar */
.mod-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.mod-filters {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.mod-search {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-primary);
  padding: .45rem .9rem;
  font-size: .85rem;
  outline: none;
  min-width: 200px;
  transition: border-color .2s;
}
.mod-search:focus { border-color: var(--gold-main); }
.mod-filters select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-primary);
  padding: .45rem .7rem;
  font-size: .85rem;
  outline: none;
  cursor: pointer;
  transition: border-color .2s;
}
.mod-filters select:focus { border-color: var(--gold-main); }

/* Table */
.table-wrap { padding: 0; overflow-x: auto; }
.mod-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.mod-table th {
  text-align: left;
  padding: .7rem 1rem;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mod-table td {
  padding: .7rem 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.mod-table tr:last-child td { border-bottom: none; }
.mod-table tr:hover td { background: rgba(255,255,255,.025); }
.tbl-loading, .tbl-empty {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-muted);
  font-style: italic;
}
.tbl-actions { display: flex; gap: .4rem; align-items: center; }
.btn-tbl {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  padding: .2rem .3rem;
  border-radius: 4px;
  transition: background .15s;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-tbl:hover { background: rgba(255,255,255,.08); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity:0; transform:translateY(-16px) scale(.97); } to { opacity:1; transform:none; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.4rem .8rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: .2rem .4rem;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem 1rem;
  padding: 1.2rem 1.4rem;
}
.fg { display: flex; flex-direction: column; gap: .3rem; }
.fg.fg-full { grid-column: 1 / -1; }
.fg label {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.fg input, .fg select, .fg textarea {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-primary);
  padding: .55rem .8rem;
  font-size: .88rem;
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
  resize: vertical;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--gold-main); }

/* ── Responsive módulos ──────────────────────────────────────── */
@media (max-width: 768px) {
  .mod-toolbar { flex-direction: column; align-items: stretch; }
  .mod-toolbar .btn { width: 100%; justify-content: center; }
  .mod-filters { flex-direction: column; }
  .mod-search, .mod-filters select, .mod-filters input[type="month"] {
    width: 100% !important;
    min-width: unset;
  }
  .form-grid { grid-template-columns: 1fr; }
  .fg.fg-full { grid-column: 1; }
  .modal-box { border-radius: 10px 10px 0 0; max-height: 92vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

@media (max-width: 480px) {
  .mod-table { font-size: .78rem; }
  .mod-table th, .mod-table td { padding: .55rem .65rem; }
}

/* KPI mini cards */
.kpi-mini {
  padding: .9rem 1.2rem !important;
}
.kpi-label {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .3rem;
}
.kpi-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}
.kpi-val.green { color: #34d399; }
.kpi-val.red   { color: #f87171; }
.kpi-val.amber { color: #fbbf24; }
