/* Che Medidores — integrado a la paleta de Che Hostel Tareas */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --border: #E4E0D6;
  --text: #2B2A26;
  --text-muted: #6E6B62;
  --accent: #0F6E56;
  --accent-soft: #E1F5EE;
  --alerta: #D85A30;
  --alerta-soft: #FAECE7;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header a.back {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
header h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.nav a.active,
.nav a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

h1.title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
}

.lede {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}

/* ---- Formulario de subida ---- */

.upload-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  max-width: 520px;
}

label.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select, input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  position: relative;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone .hint {
  font-size: 13px;
  color: var(--text-muted);
}

.preview-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 8px;
  margin-top: 12px;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

button.primary:hover { opacity: 0.9; }
button.primary:disabled { background: #C7C2B4; cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.result-panel {
  margin-top: 22px;
  padding: 20px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #cfe8de;
}

.reading-display {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.reading-display .unit {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  font-family: inherit;
}

.confidence-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 20px;
  margin-top: 8px;
}

.confidence-alta { background: #dff2e9; color: var(--accent); }
.confidence-media { background: #fdf3d9; color: #a8791a; }
.confidence-baja { background: var(--alerta-soft); color: var(--alerta); }

.correction-row {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.correction-row input[type="number"] {
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 160px;
}

.consumo-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.consumo-note strong { color: var(--text); }

.status-msg {
  font-size: 13px;
  margin-top: 10px;
}

.status-msg.error { color: var(--alerta); }
.status-msg.ok { color: var(--accent); }

/* ---- Dashboard ---- */

.sede-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.sede-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sede-card .sede-nombre {
  font-weight: 600;
  font-size: 15px;
}

.sede-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sede-reading {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.sede-reading .unit {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
  font-family: -apple-system, sans-serif;
}

.gauge { width: 52px; height: 52px; flex-shrink: 0; }

.tendencia-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  width: fit-content;
}

.tendencia-ahorro { background: #dff2e9; color: var(--accent); }
.tendencia-gasto { background: var(--alerta-soft); color: var(--alerta); }
.tendencia-sin_datos, .tendencia-igual { background: #f0f0ee; color: #8a9491; }

.sparkline { width: 100%; height: 32px; }

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 40px 0;
}

@media (max-width: 560px) {
  .reading-display { font-size: 28px; }
  .page { padding: 20px 16px 48px; }
}
