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

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

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────────── */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

.login-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #111827;
}

#login-form input {
  display: block;
  width: 100%;
  padding: .75rem 1rem;
  margin-bottom: .75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s;
}

#login-form input:focus { border-color: #2563eb; }

#login-form button {
  width: 100%;
  padding: .75rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

#login-form button:hover { background: #1d4ed8; }
#login-form button:disabled { background: #93c5fd; cursor: default; }

.error {
  margin-top: .75rem;
  color: #dc2626;
  font-size: .875rem;
  text-align: center;
}

/* ── Header ────────────────────────────────────────────── */

header {
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1rem;
}

header span { font-weight: 700; font-size: 1rem; }

#logout-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  padding: .35rem .75rem;
  border-radius: 6px;
  font-size: .875rem;
  cursor: pointer;
}

#logout-btn:hover { background: rgba(255,255,255,.3); }

/* ── Date nav ──────────────────────────────────────────── */

.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.date-nav button {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  font-size: .875rem;
  cursor: pointer;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
}

.date-nav button:hover { background: #f3f4f6; }

#current-date-label {
  font-weight: 600;
  font-size: .95rem;
  text-transform: capitalize;
}

/* ── Tabs ──────────────────────────────────────────────── */

.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.tab {
  flex: 1;
  padding: .75rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: .95rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all .15s;
}

.tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* ── Content ───────────────────────────────────────────── */

#content { padding: 1rem; }

.loading, .empty {
  color: #6b7280;
  text-align: center;
  padding: 2rem 0;
  font-size: .95rem;
}

/* ── Agenda ────────────────────────────────────────────── */

.apt-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #fff;
  border-radius: 10px;
  padding: .875rem 1rem;
  margin-bottom: .5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.hora {
  font-size: 1rem;
  font-weight: 700;
  color: #2563eb;
  min-width: 3rem;
}

.apt-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.cliente {
  font-weight: 600;
  font-size: .95rem;
}

.servicio {
  font-size: .8rem;
  color: #6b7280;
}

.bloqueo {
  font-size: .9rem;
  color: #9ca3af;
  font-style: italic;
}

/* Status badges */
.badge {
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-ok      { background: #dcfce7; color: #166534; }
.badge-done    { background: #dbeafe; color: #1e40af; }
.badge-cancel  { background: #f3f4f6; color: #6b7280; }
.badge-noshow  { background: #fee2e2; color: #991b1b; }

/* ── Conversaciones ────────────────────────────────────── */

.conversation {
  background: #fff;
  border-radius: 10px;
  margin-bottom: .75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow: hidden;
}

.conv-header {
  background: #f9fafb;
  padding: .75rem 1rem;
  font-weight: 700;
  font-size: .875rem;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.conv-header:hover { background: #f3f4f6; }

.conv-header .chevron {
  font-size: .7rem;
  color: #9ca3af;
  transition: transform .2s;
}

.conversation.open .conv-header { border-bottom: 1px solid #e5e7eb; }
.conversation.open .chevron { transform: rotate(180deg); }

.conv-messages {
  padding: .5rem .75rem;
  display: none;
}

.conversation.open .conv-messages { display: block; }

.msg {
  display: flex;
  flex-direction: column;
  margin-bottom: .5rem;
}

.msg-hora {
  font-size: .7rem;
  color: #9ca3af;
  margin-bottom: .1rem;
}

.msg-content {
  display: inline-block;
  max-width: 85%;
  padding: .45rem .7rem;
  border-radius: 10px;
  font-size: .875rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-user .msg-hora  { align-self: flex-start; }
.msg-user .msg-content {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}

.msg-assistant .msg-hora  { align-self: flex-end; }
.msg-assistant .msg-content {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 3px;
  align-self: flex-end;
}
