:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand { font-weight: 700; font-size: 18px; color: var(--primary); text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 16px; color: var(--text-muted); font-size: 14px; }

main { max-width: 900px; margin: 0 auto; padding: 32px 16px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }

/* Botones */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: var(--radius);
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 500;
  border: none; cursor: pointer; text-decoration: none; transition: background .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-link { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 0; }
.btn-link:hover { color: var(--text); }

/* Cards */
.bot-list { display: flex; flex-direction: column; gap: 12px; }
.bot-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.bot-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.bot-actions { display: flex; gap: 8px; align-items: center; }

/* Status badge */
.status-badge {
  display: inline-block; font-size: 13px; font-weight: 500; padding: 2px 10px;
  border-radius: 99px;
}
.status-badge.active { background: #dcfce7; color: #15803d; }
.status-badge.inactive { background: #f3f4f6; color: var(--text-muted); }
.status-badge.large { font-size: 16px; padding: 6px 16px; margin-bottom: 12px; display: block; width: fit-content; }

.last-activity { font-size: 12px; color: var(--text-muted); margin-left: 8px; }

/* Auth */
.auth-card {
  max-width: 380px; margin: 80px auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
}
.auth-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 24px; color: var(--primary); }

/* Forms */
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; margin-top: 16px; }
input[type=text], input[type=email], input[type=password], input[type=time] {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; background: var(--bg);
}
input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
small { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: block; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 14px; color: var(--text-muted); }
.checkbox-label input { width: auto; }
.auth-card .btn, .config-form .btn { margin-top: 20px; width: 100%; text-align: center; }

.config-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 600px; }
.config-form h3 { margin-top: 24px; font-size: 15px; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-group { margin-top: 0; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* Empty state */
.empty-state { text-align: center; padding: 48px; color: var(--text-muted); }
.empty-state .btn { margin-top: 16px; }

/* Detail grid */
.detail-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; margin-bottom: 24px; }
.status-panel, .tasks-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.status-panel h2, .tasks-panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.action-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.action-buttons form { margin: 0; }
.action-buttons .btn { width: 100%; text-align: center; }

.task-list { list-style: none; }
.task-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-list li:last-child { border: none; }
.task-list li.done { color: var(--text-muted); }
.task-list li.done span { text-decoration: line-through; }
.btn-check {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-check:hover { border-color: var(--success); color: var(--success); background: #dcfce7; }

.config-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.config-section h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.empty { color: var(--text-muted); font-size: 14px; }

/* Calendar history */
.calendar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-month-label { font-size: 16px; font-weight: 600; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0 8px;
}
.cal-day {
  text-align: center;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 13px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day.empty { background: transparent; }
.cal-day.green  { background: #dcfce7; color: #15803d; font-weight: 500; cursor: pointer; }
.cal-day.green:hover  { background: #bbf7d0; }
.cal-day.yellow { background: #fef9c3; color: #a16207; font-weight: 500; cursor: pointer; }
.cal-day.yellow:hover { background: #fef08a; }
.cal-day.red    { background: #fef2f2; color: #dc2626; font-weight: 500; cursor: pointer; }
.cal-day.red:hover    { background: #fecaca; }
.cal-day.gray   { background: #f3f4f6; color: var(--text-muted); }
.cal-day.future { color: #d1d5db; }
.cal-day.today  { outline: 2px solid var(--primary); outline-offset: -2px; }
.day-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  min-height: 20px;
}
.day-panel:empty { display: none; }
.calendar-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.legend-item.green  { color: #15803d; }
.legend-item.yellow { color: #a16207; }
.legend-item.red    { color: #dc2626; }
.legend-item.gray   { color: var(--text-muted); }
