:root {
  /* Paleta ActivityWatch (basada en Bootstrap) */
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --border: #e3e6ea;
  --text: #212529;
  --text-muted: #6c757d;
  --primary: #007bff;
  --primary-dark: #0069d9;
  --green: #28a745;
  --amber: #ffc107;
  --red: #dc3545;
  --purple: #9b7fd4;

  /* Tipografia del sistema, igual que ActivityWatch (Bootstrap stack) */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- Navbar ---------- */
.navbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
}
.navbar-logo { color: var(--primary); font-size: 22px; }
.navbar-right { display: flex; align-items: center; gap: 14px; }
.navbar-user { color: var(--text-muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: var(--bg); border-color: var(--primary); }

.btn-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ---------- Toolbar ---------- */
.toolbar {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

.period-tabs {
  display: inline-flex;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.period-tab {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.15s;
}
.period-tab:last-child { border-right: none; }
.period-tab:hover { background: var(--bg); }
.period-tab.active { background: var(--primary); color: #fff; }

.date-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}
.date-inputs input[type="date"] {
  border: none;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: transparent;
}
.date-sep { color: var(--text-muted); }

.select {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  min-width: 170px;
}

/* ---------- Container / cards ---------- */
.container { padding: 0 24px 40px; max-width: 1400px; margin: 0 auto; }

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-value {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
}
.stat-value--text { font-size: 18px; color: var(--text); }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.cards-grid--2 { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.card-header {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.card-hint { font-size: 12px; color: var(--text-muted); font-weight: 400; }

.muted { color: var(--text-muted); font-size: 13px; text-align: center; padding: 16px 0; }

/* ---------- Bar lists ---------- */
.bar-item { margin-bottom: 10px; }
.bar-item:last-child { margin-bottom: 0; }
.bar-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 4px;
}
.bar-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-item-exe { color: var(--text-muted); font-size: 11px; }
.bar-item-time { color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-track { height: 22px; background: var(--bg); border-radius: 4px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 4px; }
.bar-fill--app { background: #f8b76b; }
.bar-fill--title { background: #7ec9a2; }
.bar-fill--domain { background: #a99be0; }

/* ---------- Ranking ---------- */
.ranking-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.ranking-row:last-child { border-bottom: none; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.status-dot--active { background: var(--green); }
.status-dot--recent { background: var(--amber); }
.status-dot--offline { background: #ced4da; }
.ranking-info { display: flex; flex-direction: column; min-width: 0; }
.ranking-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-host { font-size: 11px; color: var(--text-muted); }
.ranking-time { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

#timelineWrap { position: relative; min-height: 80px; }
.panel-error { color: var(--red); font-size: 13px; padding: 10px 0; }

/* ---------- Footer ---------- */
.footer {
  padding: 14px 24px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo { font-size: 40px; color: var(--primary); line-height: 1; }
.login-brand h1 { font-size: 20px; margin: 10px 0 4px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-muted); }
.login-form input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font);
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.login-form button {
  margin-top: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}
.login-form button:hover { background: var(--primary-dark); }
.login-form button:disabled { opacity: 0.7; cursor: default; }
.login-error { color: var(--red); font-size: 13px; margin: 4px 0 0; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .summary-row { grid-template-columns: repeat(2, 1fr); }
  .cards-grid, .cards-grid--2 { grid-template-columns: 1fr; }
}
