/* ═══════════════════════════════════════
   Hermes T1 Dashboard - Apple/iOS style
   ═══════════════════════════════════════ */

:root {
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --card-soft: #FAFAFC;
  --text: #1D1D1F;
  --text2: #515154;
  --text3: #86868B;
  --text4: #C7C7CC;
  --divider: #E5E5EA;
  --divider-soft: #F2F2F7;
  --blue: #007AFF;
  --blue-soft: #E5F0FF;
  --green: #34C759;
  --green-soft: #E3F8E9;
  --orange: #FF9500;
  --orange-soft: #FFF1DD;
  --red: #FF3B30;
  --red-soft: #FFE5E3;
  --yellow: #FFCC00;
  --purple: #AF52DE;
  --purple-soft: #F4E5FA;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.04);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
  font-size: 15px;
  line-height: 1.45;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ── LAYOUT ── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 32px 40px 80px; }

/* ── NAVBAR ── */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245,245,247,.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.navbar-inner { max-width: 1280px; margin: 0 auto; padding: 12px 40px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 28px; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--text3); font-weight: 500; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--divider);
  font-size: 12px; font-weight: 500; color: var(--text2);
}
.nav-pill.subtle { color: var(--text3); background: transparent; border: none; }
.nav-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); }
.nav-pill.healthy .dot, .nav-pill.green .dot { background: var(--green); }
.nav-pill.warning .dot, .nav-pill.orange .dot { background: var(--orange); animation: pulse 2s infinite; }
.nav-pill.alert .dot, .nav-pill.red .dot { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFF 100%);
  border-radius: 24px; padding: 36px 40px;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}
.hero-eyebrow {
  font-size: 12px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.hero-title { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 24px; line-height: 1.15; }
.hero-title .accent { color: var(--blue); }
.hero-title .accent-green { color: var(--green); }
.hero-title .accent-orange { color: var(--orange); }
.hero-title .accent-red { color: var(--red); }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  padding-top: 24px; border-top: 1px solid var(--divider-soft);
}
.hero-stat .label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.hero-stat .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.hero-stat .value.green { color: var(--green); }
.hero-stat .value.orange { color: var(--orange); }
.hero-stat .value.red { color: var(--red); }
.hero-stat .sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ── SECTIONS ── */
.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; padding: 0 4px; }
.section-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.section-sub { font-size: 13px; color: var(--text3); font-weight: 500; }

/* ── GRIDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.equipos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── CARDS ── */
.card {
  background: var(--card); border-radius: 18px; padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-head { font-size: 12px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.card-meta { font-size: 12.5px; color: var(--text3); margin-top: 8px; }

/* ── KPI CARDS ── */
.kpi-card { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.kpi-icon.blue { background: var(--blue-soft); }
.kpi-icon.green { background: var(--green-soft); }
.kpi-icon.orange { background: var(--orange-soft); }
.kpi-icon.purple { background: var(--purple-soft); }
.kpi-icon.red { background: var(--red-soft); }
.kpi-label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.kpi-value.green { color: var(--green); }
.kpi-value.red { color: var(--red); }
.kpi-value.orange { color: var(--orange); }
.kpi-meta { font-size: 12.5px; color: var(--text3); }

/* ── BIG NUMBER ── */
.big-number { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; color: var(--blue); margin: 8px 0; line-height: 1; }

/* ── EQUIPOS ── */
.equipo-card {
  background: var(--card); border-radius: 16px; padding: 18px;
  box-shadow: var(--shadow-sm); position: relative;
}
.equipo-card.up { border-left: 3px solid var(--green); }
.equipo-card.down { border-left: 3px solid var(--red); }
.equipo-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.equipo-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.equipo-status-dot { width: 10px; height: 10px; border-radius: 50%; }
.equipo-status-dot.up { background: var(--green); box-shadow: 0 0 0 4px rgba(52,199,89,.15); }
.equipo-status-dot.down { background: var(--red); animation: pulse 1s infinite; }
.equipo-id { font-size: 11px; color: var(--text3); font-family: 'SF Mono', monospace; }
.equipo-meta { font-size: 12px; color: var(--text3); margin-top: 6px; }

/* ── RING METRICS (CPU, MEM, DISK) ── */
.metric-card { text-align: center; padding: 24px; }
.ring { position: relative; width: 140px; height: 140px; margin: 0 auto 12px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--divider-soft); stroke-width: 12; }
.ring-fill { fill: none; stroke: var(--blue); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1); }
.ring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2px; }
.ring-num { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.ring-unit { font-size: 14px; color: var(--text3); font-weight: 500; }

/* Colores ring por nivel */
.ring.low .ring-fill { stroke: var(--green); }
.ring.mid .ring-fill { stroke: var(--orange); }
.ring.high .ring-fill { stroke: var(--red); }

/* ── TOKENS BARS ── */
.tokens-bars { display: flex; flex-direction: column; gap: 12px; }
.token-row { display: flex; align-items: center; gap: 10px; }
.token-label { font-size: 12px; font-weight: 500; color: var(--text2); width: 80px; }
.token-bar { flex: 1; height: 14px; background: var(--divider-soft); border-radius: 7px; overflow: hidden; position: relative; }
.token-bar-fill { height: 100%; border-radius: 7px; transition: width .4s ease; }
.token-bar-fill.input { background: linear-gradient(90deg, var(--blue), #5AC8FA); }
.token-bar-fill.output { background: linear-gradient(90deg, var(--green), #6EE7B7); }
.token-bar-fill.cached { background: linear-gradient(90deg, var(--purple), #C77DFF); }
.token-value { font-size: 12px; font-weight: 600; min-width: 80px; text-align: right; }

/* ── STAT CARDS (skills, knowledge) ── */
.stat-card { display: flex; flex-direction: column; gap: 14px; }
.stat-label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: var(--blue); }
.stat-list { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--divider-soft); }
.stat-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.stat-item span:first-child { color: var(--text2); }
.stat-item .count { color: var(--text); font-weight: 600; }
.stat-pill {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
}
.stat-pill.green { background: var(--green-soft); color: #1B5E20; }
.stat-pill.orange { background: var(--orange-soft); color: #7A3E00; }
.stat-pill.red { background: var(--red-soft); color: #7A1F19; }
.stat-pill.gray { background: var(--divider-soft); color: var(--text2); }

/* ── SATURACION LIST ── */
.sat-list { display: flex; flex-direction: column; gap: 12px; }
.sat-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px; background: var(--card-soft); border-radius: 12px;
  border-left: 3px solid var(--green);
}
.sat-item.warning { border-left-color: var(--orange); }
.sat-item.critical { border-left-color: var(--red); }
.sat-row1 { display: flex; justify-content: space-between; align-items: baseline; }
.sat-name { font-weight: 600; font-size: 13px; }
.sat-pct { font-size: 18px; font-weight: 700; }
.sat-pct.warning { color: var(--orange); }
.sat-pct.critical { color: var(--red); }
.sat-meta { font-size: 12px; color: var(--text3); }
.sat-bar { height: 5px; background: var(--divider-soft); border-radius: 3px; overflow: hidden; margin-top: 2px; }
.sat-bar-fill { height: 100%; background: var(--green); transition: width .4s; }
.sat-bar-fill.warning { background: var(--orange); }
.sat-bar-fill.critical { background: var(--red); }
.empty-state { padding: 30px; text-align: center; color: var(--text3); }

/* ── CHARTS ── */
.chart-container { position: relative; min-height: 220px; }.uplot { font-family: inherit !important; }

/* ── TIMELINE ── */
.timeline { display: flex; flex-direction: column; gap: 4px; max-height: 500px; overflow-y: auto; padding-right: 8px; }
.timeline-item {
  display: flex; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--divider-soft);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-time { width: 110px; flex-shrink: 0; font-size: 12px; color: var(--text3); font-family: 'SF Mono', monospace; padding-top: 2px; }
.timeline-icon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.timeline-icon.info { background: var(--blue-soft); }
.timeline-icon.success { background: var(--green-soft); }
.timeline-icon.warning { background: var(--orange-soft); }
.timeline-icon.error { background: var(--red-soft); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 14px; font-weight: 500; }
.timeline-detail { font-size: 12.5px; color: var(--text3); margin-top: 2px; }

/* ── FOOTER ── */
footer {
  max-width: 1280px; margin: 0 auto; padding: 20px 40px 40px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--text3); border-top: 1px solid var(--divider-soft);
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .equipos-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .wrap { padding: 20px; }
  .navbar-inner { padding: 12px 20px; }
  .hero { padding: 24px; }
  .hero-title { font-size: 24px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .equipos-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .timeline-time { width: 80px; }
}
