:root {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22d3ee;
  --error: #ef4444;
  --tile: #0b1220;
  --tile-border: #1f2937;
  --day: clamp(36px, calc((100vw - 48px)/7), 64px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1000px 600px at 20% -10%, #0b1220, transparent),
              radial-gradient(1000px 600px at 80% -10%, #11203a, transparent),
              var(--bg);
}

#sys-prompt {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box; /* incluye padding en el ancho */
}

.center {
  display: grid;
  place-items: center;
}

.card {
  width: 100%;
  max-width: 100%;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  overflow-x: auto;
  box-sizing: border-box;
}

h1 { margin: 0 0 8px 0; font-size: 22px; }
h2 { margin-top: 0; }

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 14px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.15);
}

button {
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  background: linear-gradient(90deg, #22d3ee, #60a5fa);
  color: #0b1220;
  cursor: pointer;
}

.error {
  color: var(--error);
  min-height: 20px;
  margin-top: 10px;
}

nav{
  color: #ddd;
}

.muted { color: var(--muted); }
.tiny { font-size: 12px; }

/* Dashboard */
.topbar{
  position: sticky;
  top: 0;
  z-index: 1000;
  display:flex; justify-content:space-between; align-items:center;
  padding: calc(12px + env(safe-area-inset-top,0)) 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(2,6,23,.96), rgba(2,6,23,.88)); /* sólido dark */
  -webkit-backdrop-filter: saturate(120%) blur(6px);
  backdrop-filter: saturate(120%) blur(6px);
}

.brand { font-weight: 700; }

.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 16px;
}

.tile {
  display: block;
  border: 1px solid var(--tile-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  padding: 16px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: transform .12s ease, border-color .12s ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: rgba(34,211,238,0.4);
}


table {
  width: 100%;
  border-collapse: collapse;
}

td, th {
  padding: 0.5rem;
  border: 1px solid #ccc;
  vertical-align: middle;
  text-align: left;
  word-break: break-word;
  max-width: 200px; /* ajusta según diseño */
}

.card {
  overflow-x: auto;
}

button {
  margin-right: 4px;
  padding: 4px 8px;
  font-size: 0.9em;
  cursor: pointer;
}



.cal-controls{display:flex;align-items:center;gap:8px;justify-content:center;margin-bottom:8px}
.legend{display:flex;gap:8px;margin-bottom:12px;justify-content:center}
.badge{padding:2px 8px;border-radius:12px;font-size:.85rem;border:1px solid #ddd; color: #0b1220;}
.badge.open{background:#b8f7c2}
.badge.closed{background:#ffc4c4}
.badge.unknown{background:#e9edf2}
.cal-wrap{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.calendar{
  width: 100%;
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap:8px;
  justify-items: stretch;
}
.calendar .dow{
  height: 28px;
  display:flex; align-items:center; justify-content:center;
  font-weight:600; font-size:.9rem; color: var(--muted);
}
.day{
  width: 100%;
  aspect-ratio: 1 / 1;          /* 👈 hace el cuadrado y evita que se corte el domingo */
  border:1px solid #1f2937;
  border-radius:12px;
  padding:6px;
  display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start;
  gap:4px; cursor:pointer;
  color:#0b1220;
}
/* Estados con fondo claro → texto oscuro */
.day.open   { background: #b8f7c2; color:#0b1220; }   /* verde más marcado */
.day.closed { background: #ffc4c4; color:#0b1220; }   /* rojo más marcado */
.day.unknown{ background: #e9edf2; color:#0b1220; }   /* gris claro */

.day .num{ font-weight:700; font-size:.95rem; }

.calendar .dow { color: var(--muted); opacity: .95; }

/* “Fuera de mes” sin matar el contraste del texto */
.day.out { opacity:.5; }

html, body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }


@media (max-width: 820px){
  .cal-wrap{ grid-template-columns: 1fr !important; }
  .calendar{ justify-content:center; } /* centra las 7 columnas */
}