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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f7;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ─── HEADER ─────────────────────────────────────── */
.header {
  background: #1a1a2e;
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.logo { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }

.setter-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.setter-status.active  { background: #dcfce7; color: #166534; }
.setter-status.inactive { background: #fee2e2; color: #991b1b; }

.header-right { font-size: 13px; color: #9ca3af; }

/* ─── METRICS ────────────────────────────────────── */
.metrics-bar {
  background: white;
  display: flex;
  border-bottom: 1px solid #e5e7eb;
}

.metric {
  flex: 1;
  padding: 14px 12px;
  text-align: center;
  border-right: 1px solid #f3f4f6;
}
.metric:last-child { border-right: none; }
.metric.highlight  { background: #f0fdf4; }

.metric-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1;
}
.metric.highlight .metric-value { color: #16a34a; }

.metric-label {
  display: block;
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
}

/* ─── NAV TABS ───────────────────────────────────── */
.nav-tabs {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 24px;
  display: flex;
}

.tab {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab:hover  { color: #1a1a2e; }
.tab.active { color: #5b4cf5; border-bottom-color: #5b4cf5; }

/* ─── MAIN ───────────────────────────────────────── */
.main { padding: 20px 24px; }

.view { display: none; }
.view.active { display: block; }

/* ─── KANBAN ─────────────────────────────────────── */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 210px);
}

.kanban-col {
  flex: 0 0 230px;
  background: #f8f9fc;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 8px;
}

.col-title {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #374151;
}

.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.col-count {
  font-size: 11px;
  color: #6b7280;
  background: white;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* ─── GYM CARDS ──────────────────────────────────── */
.gym-card {
  background: white;
  border-radius: 8px;
  padding: 11px 12px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  transition: all 0.15s;
}
.gym-card:hover {
  border-color: #5b4cf5;
  box-shadow: 0 2px 8px rgba(91,76,245,0.12);
  transform: translateY(-1px);
}

.gym-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.gym-meta {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.gym-type-badge {
  background: #ede9fe;
  color: #5b4cf5;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  text-transform: capitalize;
}

.gym-city { font-size: 11px; color: #9ca3af; }

.gym-time {
  font-size: 10px;
  color: #d1d5db;
  margin-top: 5px;
}

.col-more {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 6px;
}

/* ─── DETAIL PANEL ───────────────────────────────── */
.detail-panel {
  position: fixed;
  top: 0;
  right: -460px;
  width: 440px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow-y: auto;
  transition: right 0.28s ease;
}
.detail-panel.open { right: 0; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 190;
  backdrop-filter: blur(1px);
}
.overlay.visible { display: block; }

.detail-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f3f4f6;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #6b7280;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover { background: #e5e7eb; }

.detail-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
  padding-right: 36px;
}

.badge {
  display: inline-block;
  background: #ede9fe;
  color: #5b4cf5;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  margin-top: 5px;
}

.detail-section {
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.info-row {
  display: flex;
  gap: 10px;
  font-size: 13px;
  align-items: center;
  margin-bottom: 6px;
  color: #374151;
}
.info-row a { color: #5b4cf5; text-decoration: none; }
.info-row a:hover { text-decoration: underline; }

.detail-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #1a1a2e;
  background: #f9fafb;
  cursor: pointer;
}
.detail-select:focus { outline: none; border-color: #5b4cf5; }

.detail-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: #f9fafb;
  resize: vertical;
  min-height: 70px;
  font-family: inherit;
  margin-bottom: 8px;
}
.detail-textarea:focus { outline: none; border-color: #5b4cf5; }

/* ─── MESSAGES / CHAT ────────────────────────────── */
.chat-section {
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 320px;
  overflow-y: auto;
  padding: 8px 4px;
  background: #f9fafb;
  border-radius: 8px;
}

.message {
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13px;
  max-width: 82%;
  line-height: 1.5;
  word-break: break-word;
}
.message.outbound {
  background: #5b4cf5;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.message.inbound {
  background: white;
  color: #1a1a2e;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid #e5e7eb;
}
.message-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 3px;
  text-align: right;
}
.message.inbound .message-time { text-align: left; }

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 20px 14px;
  border-top: 1px solid #f3f4f6;
  background: white;
}

.chat-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  line-height: 1.4;
  max-height: 100px;
  outline: none;
}
.chat-input:focus { border-color: #5b4cf5; }

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #5b4cf5;
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: #4f46e5; }

.empty-state {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 20px 0;
}

/* ─── BUTTONS ────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: #5b4cf5; color: white; }
.btn-primary:hover { background: #4f46e5; }
.btn-success { background: #22c55e; color: white; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ─── COLA HOY ───────────────────────────────────── */
.queue-header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 680px;
}

.queue-item {
  display: grid;
  grid-template-columns: 28px 52px 1fr auto;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
}

.queue-sent {
  opacity: 0.5;
  background: #f9fafb;
}

.queue-sending {
  border-color: #f59e0b;
  background: #fffbeb;
}

.queue-status { font-size: 15px; }
.queue-time   { font-weight: 600; color: #374151; font-variant-numeric: tabular-nums; }
.queue-name   { color: #111827; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-phone  { color: #9ca3af; font-size: 12px; }

/* ─── ACTIVITY ───────────────────────────────────── */
.activity-feed {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  background: white;
  border-radius: 8px;
  padding: 11px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid #e5e7eb;
}

.activity-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

.activity-text {
  font-size: 13px;
  color: #374151;
  flex: 1;
  line-height: 1.4;
}
.activity-gym { font-weight: 600; }

.activity-time { font-size: 11px; color: #9ca3af; flex-shrink: 0; white-space: nowrap; }

/* ─── TEMPLATES ──────────────────────────────────── */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.template-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e5e7eb;
}

.template-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}

.template-type {
  display: inline-block;
  font-size: 10px;
  background: #f3f4f6;
  color: #6b7280;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-weight: 500;
}

.template-textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  color: #374151;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  background: #f9fafb;
  line-height: 1.5;
}
.template-textarea:focus { outline: none; border-color: #5b4cf5; }

.template-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* ─── CONFIG ─────────────────────────────────────── */
.config-panel {
  max-width: 480px;
  background: white;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e5e7eb;
}

.config-panel h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f3f4f6;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f9fafb;
}
.config-row:last-child { border-bottom: none; }

.config-row label {
  flex: 1;
  font-size: 14px;
  color: #374151;
}

.config-input {
  width: 72px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.toggle-group { display: flex; gap: 8px; }

/* ─── SEMANA ─────────────────────────────────────── */
.week-desc {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 14px;
  line-height: 1.5;
}

.week-days {
  display: flex;
  gap: 8px;
}

.week-day {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  background: #f9fafb;
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-day-on {
  background: #f0fdf4;
  border-color: #86efac;
  color: #16a34a;
}

/* ─── TOAST ──────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1a2e;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── SCROLLBAR ──────────────────────────────────── */
.kanban::-webkit-scrollbar          { height: 5px; }
.kanban::-webkit-scrollbar-track   { background: transparent; }
.kanban::-webkit-scrollbar-thumb   { background: #d1d5db; border-radius: 3px; }
.messages-list::-webkit-scrollbar  { width: 4px; }
.messages-list::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 2px; }

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 768px) {
  .metrics-bar { overflow-x: auto; }
  .metric { min-width: 90px; }
  .detail-panel { width: 100%; right: -100%; }
  .main { padding: 12px 16px; }
  .header { padding: 0 16px; }
  .nav-tabs { padding: 0 16px; overflow-x: auto; }
  .tab { padding: 12px 14px; white-space: nowrap; }
}
