/* ============================================================
   Panel de Citas — sistema visual base
   ------------------------------------------------------------
   Brief: herramienta interna de operaciones para gestionar la
   disponibilidad de asesores y sus calendarios. La usan el jefe
   y sistemas. Debe sentirse como un instrumento de trabajo —
   claro, denso en información, legible de un vistazo — no como
   una landing. Referencia mental: panel de control / consola de
   agenda, no marketing.

   Decisiones deliberadas (evitando los defaults genéricos):
   - Fondo blanco frío casi papel técnico, NO crema.
   - Acento verde-pino profundo (agenda / disponibilidad), NO
     terracota ni acid-green.
   - Tipografía: una sans humanista para todo el cuerpo (legible
     en tablas densas), y números tabulares para horarios.
   - Cero sombras suaves de tarjeta; separación por líneas finas
     y color de fondo, como una hoja de cálculo bien diseñada.
   ============================================================ */

:root {
  --bg:            #f7f8f7;   /* papel técnico, frío */
  --surface:       #ffffff;
  --ink:           #1b211e;   /* casi negro verdoso, no #000 */
  --ink-soft:      #5a635e;
  --line:          #dde2df;
  --line-strong:   #c3ccc6;
  --accent:        #1f5c47;   /* verde pino: disponibilidad, agenda */
  --accent-soft:   #e6f0eb;
  --accent-ink:    #123a2c;
  --busy:          #b23a34;   /* ocupado / bloqueado */
  --busy-soft:     #f6e7e6;
  --warn:          #9a6a17;
  --focus:         #2f8f6f;

  --radius:        6px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Inter", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- números tabulares para horarios y horas ---- */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ============================================================
   Layout general con barra superior
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar .brand .mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.topbar .who {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 14px;
}

.topbar .who img {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: #f0f2f1; }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #eef1f0; color: var(--ink); }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   Cartelería / estados vacíos y errores
   ============================================================ */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 14px;
}
.notice.error {
  border-color: #e3b7b4;
  background: var(--busy-soft);
  color: #7f2621;
}

/* ============================================================
   Utilidades
   ============================================================ */
.muted { color: var(--ink-soft); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================
   ENTREGA 2 — lista de asesores y editor de horarios
   ------------------------------------------------------------
   Sigue la misma idea del resto: densidad de hoja de calculo,
   separacion por lineas finas, cero sombras. Los horarios usan
   numeros tabulares para que las columnas de horas se alineen.
   ============================================================ */

.page-title {
  font-size: 24px;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.back {
  display: inline-block;
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.back:hover { color: var(--accent); }

.footnote { font-size: 13px; margin: 0; }

/* ---- Tabla de datos ---- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbfa; }

.col-nombre a { font-weight: 600; color: var(--ink); }
.col-nombre a:hover { color: var(--accent); }
/* El resumen salta de linea ENTRE tramos, nunca dentro de uno: asi un
   horario partido no empuja las demas columnas fuera de la pantalla. */
.col-horario { color: var(--ink-soft); }
.col-horario .tramo { white-space: nowrap; }
.col-horario .sep-dot { color: var(--line-strong); }
.col-accion { text-align: right; white-space: nowrap; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 1px 4px 1px 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  white-space: nowrap;
}

.ok { color: var(--accent); font-weight: 500; white-space: nowrap; }

.btn-sm { padding: 5px 11px; font-size: 13px; }

/* ---- Switch activo / inactivo ---- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-soft);
}
.switch:hover { background: #eef1f0; }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch[disabled] { opacity: 0.55; cursor: progress; }

.switch-track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 120ms ease;
  flex: none;
}
.switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 120ms ease;
}
.switch.is-on .switch-track { background: var(--accent); }
.switch.is-on .switch-knob { transform: translateX(14px); }
.switch.is-on .switch-label { color: var(--accent-ink); font-weight: 500; }

/* ---- Editor de horarios ---- */
.dias {
  display: grid;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dia {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.dia:last-child { border-bottom: none; }

.dia-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dia-nombre {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.franjas { display: flex; flex-direction: column; gap: 8px; }
.franjas:not(:empty) { margin-top: 10px; }

.franja {
  display: flex;
  align-items: center;
  gap: 8px;
}

.franja input[type="time"] {
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.franja input[type="time"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.franja .sep { color: var(--ink-soft); font-size: 13px; }

.btn-x {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  line-height: 1;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-x:hover { background: var(--busy-soft); color: var(--busy); }
.btn-x:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.dia-vacio { font-size: 13px; margin: 8px 0 0; }

/* ---- Barra de guardado ---- */
.guardar-barra {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}
.guardar-barra .resultado { flex: 1 1 100%; }
.guardar-barra .resultado:empty { display: none; }

.notice.ok-notice {
  border-color: #b9d5c9;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

ul.errores { margin: 8px 0 0; padding-left: 18px; }
ul.errores li { margin-top: 2px; }

/* Indicador de HTMX: solo visible mientras hay peticion en vuelo. */
.htmx-indicator { opacity: 0; transition: opacity 120ms ease; font-size: 13px; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ---- Tablet (el jefe usa iPad) ---- */
@media (max-width: 720px) {
  table.data th:nth-child(2),
  table.data td:nth-child(2) { display: none; }
  .dia-head { flex-wrap: wrap; }
}
