/* Colores del tema de Telegram (con valores por defecto para abrirlo fuera de Telegram). */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f1f4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #2481cc);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --ok: #2fb36b;
  --holiday: #f2a33a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.hint { color: var(--hint); font-size: 13px; margin: 0; }
.pad { padding: 4px 4px 12px; }
.center { text-align: center; }

/* Cabecera */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
}
h1 { font-size: 19px; margin: 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  display: block; width: 50px; height: 30px; border-radius: 15px; background: var(--hint); opacity: .55;
  position: relative; transition: background .2s, opacity .2s;
}
.switch .thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--ok); opacity: 1; }
.switch input:checked + .track .thumb { transform: translateX(20px); }
.switch input:disabled + .track { cursor: default; }

/* Pestañas */
.tabs { display: flex; background: var(--card); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.tab { flex: 1; padding: 8px 0; border-radius: 10px; font-weight: 600; color: var(--hint); }
.tab.active { background: var(--accent); color: var(--accent-text); }

.banner { background: var(--card); border-left: 4px solid var(--danger); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }

/* Semana */
.week-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; font-size: 26px; line-height: 1; color: var(--link); }
.icon-btn:active { background: var(--card); }
.week-title { font-weight: 700; font-size: 16px; padding: 6px 10px; border-radius: 10px; }
.week-title.static { cursor: default; }
.days, .cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.day {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius); padding: 10px 14px; min-height: 64px;
}
.day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.day.past, .day.weekend { opacity: .55; }
.day .date { text-align: center; }
.day .wd { display: block; font-size: 12px; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; }
.day .dn { display: block; font-size: 22px; font-weight: 700; line-height: 1.1; }
.day .main { min-width: 0; }
.day .title { font-weight: 600; }
.day .sub { font-size: 13px; color: var(--hint); }
.spot { font-size: 24px; font-weight: 800; letter-spacing: .02em; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.holiday { background: color-mix(in srgb, var(--holiday) 20%, transparent); color: var(--holiday); }
.badge.muted { background: color-mix(in srgb, var(--hint) 18%, transparent); color: var(--hint); }
.footer-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px 0; }
.link-btn { color: var(--link); font-weight: 600; }
.skeleton { background: var(--card); border-radius: var(--radius); height: 64px; position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hint) 15%, transparent), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Vacaciones */
.card { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 12px 14px; }
.card .title { font-weight: 600; }
.card .sub { font-size: 13px; color: var(--hint); }
.remove { color: var(--danger); font-weight: 600; padding: 6px 8px; }
.empty { text-align: center; color: var(--hint); padding: 24px 0; background: var(--card); border-radius: var(--radius); }
.primary-btn {
  display: block; width: 100%; margin-top: 12px; padding: 13px; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); font-weight: 700;
}

/* Calendario */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head span { text-align: center; font-size: 12px; color: var(--hint); padding: 4px 0; }
.cal-grid button, .cal-grid span { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-weight: 600; }
.cal-grid button { background: var(--card); }
.cal-grid button:disabled { opacity: .3; cursor: default; }
.cal-grid button.in-range { background: color-mix(in srgb, var(--accent) 25%, var(--card)); }
.cal-grid button.edge { background: var(--accent); color: var(--accent-text); }
.cal-grid button.weekend:not(.edge):not(.in-range) { color: var(--hint); }
.center-btn { display: block; margin: 8px auto 0; padding: 8px 16px; }
