:root {
  --ink:     #0e0e0e;
  --ink-2:   #3a3a3a;
  --ink-3:   #6b6b6b;
  --ink-4:   #9b9b9b;
  --line:    #e4e4e4;
  --line-2:  #cdcdcd;
  --surface: #f6f6f4;
  --white:   #ffffff;
  --accent:  #1a1a1a;
  --blue:    #2563eb;
  --r4: 4px; --r6: 6px; --r10: 10px;
  --ff: 'DM Sans', system-ui, sans-serif;
  --fm: 'DM Mono', monospace;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── PAGE LAYOUT ────────────────────────────────────────── */
.page { max-width: 1440px; margin: 0 auto; padding: 0 24px 80px; }

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.brand-sub {
  font-size: 11px;
  color: var(--ink-4);
  font-family: var(--fm);
}
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  font-family: var(--ff);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r6);
  border: 1px solid var(--line-2);
  background: var(--white);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { border-color: #fecaca; color: #b91c1c; background: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; border-color: #b91c1c; }

/* ── MAIN GRID ──────────────────────────────────────────── */
.app-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .app-grid { grid-template-columns: 1fr; }
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r10);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-3);
}
.panel-body { padding: 14px 16px; }

/* ── FORM ELEMENTS ──────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input, .form-select {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--ff);
  font-size: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r6);
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus { border-color: var(--ink); }

/* ── TIME SLOTS PICKER ──────────────────────────────────── */
.timepicker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
}
.timepicker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: var(--r4);
  cursor: pointer;
  transition: background 0.1s;
  border: 1px solid transparent;
}
.timepicker-item:hover { background: var(--surface); }
.timepicker-item.active { background: var(--ink); border-color: var(--ink); }
.timepicker-item.active .tp-label { color: var(--white); }
.tp-label { font-family: var(--fm); font-size: 11px; color: var(--ink-3); }
.timepicker-item.active .tp-label { color: rgba(255,255,255,0.85); }

/* Scrollbar */
.timepicker-grid::-webkit-scrollbar { width: 4px; }
.timepicker-grid::-webkit-scrollbar-track { background: transparent; }
.timepicker-grid::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

/* ── ACTIVITIES LIST ────────────────────────────────────── */
.activity-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r6);
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s;
  position: relative;
}
.activity-pill:last-child { margin-bottom: 0; }
.activity-pill:hover { opacity: 0.85; }
.activity-pill.selected { border: 2px solid var(--ink); }
.act-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.act-info { flex: 1; min-width: 0; }
.act-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-meta { font-size: 11px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-slots-count {
  font-family: var(--fm);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(0,0,0,0.15);
  color: inherit;
  flex-shrink: 0;
}
.act-delete {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.15);
  border: none;
  color: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: background 0.12s;
}
.act-delete:hover { background: rgba(0,0,0,0.35); }

.empty-state {
  text-align: center;
  padding: 20px;
  color: var(--ink-4);
  font-size: 12px;
}

/* ── COLOR SWATCHES ─────────────────────────────────────── */
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.selected { border-color: var(--ink); transform: scale(1.1); }

/* ── SCHEDULE CANVAS ────────────────────────────────────── */
.schedule-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r10);
  overflow: hidden;
}
.schedule-meta {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.schedule-meta-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.schedule-meta-inst {
  font-size: 13px;
  color: var(--ink-3);
}
.schedule-scroll { overflow-x: auto; }

.sched-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}
.sched-table th {
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  white-space: nowrap;
}
.sched-table th.time-th {
  width: 80px;
  text-align: left;
  padding-left: 16px;
}
.sched-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  padding: 0;
  position: relative;
}
.sched-table td:last-child { border-right: none; }
.sched-table tr:last-child td { border-bottom: none; }
.sched-table td.time-td {
  padding: 10px 8px 10px 16px;
  font-family: var(--fm);
  font-size: 11px;
  color: var(--ink-4);
  white-space: nowrap;
  vertical-align: middle;
  background: var(--surface);
  width: 80px;
}

.cell-inner {
  min-height: 64px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background 0.1s;
}
.cell-inner:hover { background: var(--surface); }
.cell-inner.drop-target { background: #eff6ff; outline: 2px dashed #93c5fd; outline-offset: -2px; }

.cell-activity {
  border-radius: var(--r4);
  padding: 5px 7px;
  font-size: 12px;
  color: white;
  line-height: 1.3;
  position: relative;
  cursor: default;
}
.cell-act-name { font-weight: 600; }
.cell-act-meta { font-size: 10px; opacity: 0.85; margin-top: 1px; }
.cell-act-remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: rgba(0,0,0,0.25);
  border: none;
  color: white;
  font-size: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.12s;
  line-height: 1;
}
.cell-activity:hover .cell-act-remove { opacity: 1; }
.cell-act-remove:hover { background: rgba(0,0,0,0.5); }

.add-here {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--ink-4);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: all 0.12s;
  margin: auto;
  align-self: center;
}
.cell-inner:hover .add-here { opacity: 1; }
.add-here:hover { background: var(--ink); border-color: var(--ink); color: white; }

.empty-schedule {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-4);
}
.empty-schedule p { font-size: 14px; margin-top: 8px; }

/* ── NOTES ──────────────────────────────────────────────── */
.notes-area {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--ff);
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r6);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.15s;
  background: var(--white);
}
.notes-area:focus { border-color: var(--ink); }

/* ── MODAL ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--r10);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  transform: translateY(8px);
  transition: transform 0.15s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--ink-3);
  transition: background 0.12s;
}
.modal-close:hover { background: var(--line); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

/* ── ASSIGN PICKER ──────────────────────────────────────── */
.assign-activity-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.assign-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r6);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.12s;
}
.assign-pill:hover { border-color: var(--line-2); background: var(--surface); }
.assign-pill.selected { border-color: var(--ink); background: var(--ink); color: white; }
.assign-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.assign-name { font-size: 13px; font-weight: 500; }
.assign-meta { font-size: 11px; color: var(--ink-4); }
.assign-pill.selected .assign-meta { color: rgba(255,255,255,0.6); }
.assign-cell-info {
  font-family: var(--fm);
  font-size: 12px;
  color: var(--ink-3);
  background: var(--surface);
  padding: 7px 10px;
  border-radius: var(--r4);
  margin-bottom: 12px;
}

/* ── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px; right: 20px;
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  border-radius: var(--r6);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── ARTICLE ─────────────────────────────────────────────── */
.article {
  width: 95%;
  margin: 56px auto 0;
}
.article-kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-4);
  margin-bottom: 10px;
}
.article-h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 16px;
}
.article-lead {
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 32px;
  padding-left: 16px;
  border-left: 3px solid var(--ink);
}
.article-body { color: var(--ink-2); line-height: 1.75; }
.article-body h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin: 32px 0 10px;
  color: var(--ink);
}
.article-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 6px;
  color: var(--ink);
}
.article-body p { margin-bottom: 14px; font-size: 14px; }
.article-body ul { padding-left: 20px; margin-bottom: 14px; }
.article-body li { margin-bottom: 6px; font-size: 14px; }
.article-body strong { color: var(--ink); font-weight: 600; }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin: 16px 0 28px;
}
.guide-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r10);
  padding: 14px;
}
.guide-num {
  font-family: var(--fm);
  font-size: 22px;
  font-weight: 500;
  color: var(--line-2);
  margin-bottom: 6px;
}
.guide-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.guide-desc { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

.faq { margin-top: 4px; }
.faq-item { border-top: 1px solid var(--line); padding: 14px 0; }
.faq-q { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.faq-a { font-size: 13px; color: var(--ink-3); line-height: 1.6; }

/* ── OFFSCREEN EXPORT ────────────────────────────────────── */
#export-stage {
  position: fixed;
  top: -9999px; left: -9999px;
  background: white;
  font-family: 'DM Sans', sans-serif;
  z-index: -1;
  width: 1200px;
}


/* ── RESPONSIVE: MÓVIL (≤ 640px) ─────────────────────────── */
@media (max-width: 640px) {
  .page {
    padding: 0 16px 40px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .panel-head {
    padding: 10px 12px;
  }

  .panel-body {
    padding: 12px;
  }

  .timepicker-grid {
    grid-template-columns: 1fr; /* Una columna en móvil */
    max-height: 200px;
  }

  .tp-label {
    font-size: 12px; /* Más legible */
  }

  .activity-pill {
    padding: 8px;
  }

  .act-name {
    font-size: 12px;
  }

  .swatches {
    gap: 8px;
    justify-content: center;
  }

  .swatch {
    width: 32px;
    height: 32px; /* Más fácil de tocar */
  }

  .schedule-meta {
    padding: 12px;
    flex-direction: column;
    gap: 4px;
  }

  .schedule-meta-title {
    font-size: 16px;
  }

  .schedule-meta-inst {
    font-size: 11px;
  }

  /* Tabla más compacta en móvil */
  .sched-table th.time-th,
  .sched-table td.time-td {
    width: 60px;
    padding-left: 8px;
    font-size: 10px;
  }

  .cell-inner {
    min-height: 52px;
    padding: 4px;
  }

  .cell-activity {
    padding: 4px 6px;
    font-size: 11px;
  }

  .cell-act-name {
    font-size: 11px;
  }

  .cell-act-meta {
    font-size: 9px;
  }

  .add-here {
    width: 24px;
    height: 24px; /* Más fácil de tocar */
    font-size: 16px;
  }

  .modal {
    max-width: 94%;
    margin: 0 auto;
  }

  .modal-body {
    padding: 16px;
  }

  .assign-pill {
    padding: 10px;
  }

  .assign-name {
    font-size: 13px;
  }

  .notes-area {
    min-height: 70px;
    font-size: 13px;
  }

  /* Artículo / guía */
  .article {
    margin: 32px auto 0;
  }

  .article-lead {
    font-size: 14px;
    padding-left: 12px;
    margin-bottom: 24px;
  }

  .guide-grid {
    grid-template-columns: 1fr; /* Tarjetas en vertical */
  }

  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    text-align: center;
  }
}

/* ── RESPONSIVE: MÓVIL MUY PEQUEÑO (≤ 400px) ─────────────── */
@media (max-width: 400px) {
  .sched-table {
    min-width: 420px; /* Reduce el scroll extremo */
  }

  .sched-table th.time-th,
  .sched-table td.time-td {
    width: 55px;
    font-size: 9px;
  }

  .btn-sm {
    padding: 4px 8px;
  }

  .brand-name {
    font-size: 15px;
  }
}

/* ── MEJORA: TABLET (641px - 900px) ─────────────────────── */
@media (min-width: 641px) and (max-width: 900px) {
  .sidebar {
    position: static; /* Quita el sticky en tablet también */
  }

  .timepicker-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


@media (max-width: 900px) {
  .sidebar {
    position: static;
  }
}



