* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }
body { background: #f0f2f5; padding: 24px; }
#page { max-width: 1100px; margin: 0 auto; }

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
h1 { font-size: 22px; color: #1a1a2e; }
.btn-export { background: #4caf50; color: #fff; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 14px; }

/* Dashboard */
#dashboard {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.metric-card {
  background: #fff; border-radius: 10px; padding: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07); display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.metric-value { font-size: 26px; font-weight: bold; color: #3f51b5; }
.metric-label { font-size: 12px; color: #666; text-align: center; }

/* Filters */
#filters { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-row input, .filter-row select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; outline: none; }
.filter-row input:focus, .filter-row select:focus { border-color: #3f51b5; }
.filter-row button { padding: 8px 18px; background: #3f51b5; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.filter-row .btn-secondary { background: #eee; color: #333; }

/* Tabs */
#tabs { display: flex; border-bottom: 2px solid #e0e0e0; margin-bottom: 0; }
.tab { padding: 10px 20px; background: none; border: none; cursor: pointer; font-size: 14px; color: #666; }
.tab.active { color: #3f51b5; border-bottom: 3px solid #3f51b5; margin-bottom: -2px; font-weight: bold; }
.tab-content { background: #fff; border-radius: 0 0 10px 10px; padding: 0; box-shadow: 0 1px 6px rgba(0,0,0,.07); }

/* Table */
#table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f5f5f5; padding: 12px 14px; text-align: left; color: #444; font-weight: 600; border-bottom: 2px solid #e0e0e0; white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
tr:hover td { background: #fafafa; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.saliente  { background: #e3f2fd; color: #1565c0; }
.badge.entrante  { background: #e8f5e9; color: #2e7d32; }
.badge.interna   { background: #f3e5f5; color: #6a1b9a; }
.badge.contestada { background: #e8f5e9; color: #2e7d32; }
.badge.perdida   { background: #ffebee; color: #c62828; }

#pagination { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 16px; }
#pagination button { padding: 8px 16px; border: 1px solid #ddd; border-radius: 6px; background: #fff; cursor: pointer; }
#pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
#page-info { font-size: 13px; color: #666; }

/* Perdidas */
#perdidas-list { padding: 16px; }
.perdida-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid #ffcdd2; border-radius: 8px; background: #fff9f9; margin-bottom: 10px; }
.perdida-info span { display: block; }
.perdida-info .num { font-weight: bold; font-size: 16px; }
.perdida-info .ts  { font-size: 12px; color: #888; }
.btn-rellamar { background: #4caf50; color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; }

/* Consumo */
#consumo-wrap { padding: 16px; }
#consumo-totals { margin-top: 16px; padding: 14px; background: #e8eaf6; border-radius: 8px; font-size: 14px; }

.hidden { display: none !important; }
