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

:root {
  --bg:         #0f0f1a;
  --surface:    #1a1a2e;
  --surface2:   #22223a;
  --border:     #2e2e4a;
  --accent:     #7c5cbf;
  --accent-lt:  #9b7de0;
  --text:       #e8e8f0;
  --text-dim:   #8888aa;
  --danger:     #c0392b;
  --success:    #27ae60;
  --radius:     12px;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 2rem;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem 1rem;
  text-align: center;
}

header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
header p  { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.2rem; }

/* ── Main ── */
main { max-width: 480px; margin: 0 auto; padding: 1.25rem 1rem; }

/* ── Sections ── */
section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

section h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-lt);
  margin-bottom: 1rem;
}

/* ── Form ── */
.field { margin-bottom: 0.85rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.field input, .field select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.field input:focus, .field select:focus {
  border-color: var(--accent);
}

.field select option { background: var(--surface2); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field-row .field { min-width: 0; }
.field-row .field input { width: 100%; min-width: 0; }

button[type="submit"] {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s, transform 0.1s;
}

button[type="submit"]:hover  { background: var(--accent-lt); }
button[type="submit"]:active { transform: scale(0.98); }
button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(4rem);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 999;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.error { border-color: var(--danger); color: #ff7676; }
#toast.ok    { border-color: var(--success); color: #6feea0; }

/* ── Appointments list ── */
.empty-state {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 1.5rem 0;
}

.appt-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.appt-item:last-child { border-bottom: none; }

.appt-info { flex: 1; min-width: 0; }

.appt-desc {
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.appt-author {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  margin-top: 0.35rem;
}
.appt-author.Diego  { background: #2d1f5e; color: #c4a8ff; }
.appt-author.Sandra { background: #1f3a2d; color: #80ffba; }

.appt-today { border-left: 3px solid var(--accent); padding-left: 0.6rem; }

.appt-actions { display: flex; gap: 0.4rem; flex-shrink: 0; align-items: center; }

.btn-edit, .btn-delete {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  transition: opacity 0.15s, transform 0.1s;
  line-height: 1.4;
  white-space: nowrap;
}
.btn-edit:active, .btn-delete:active { transform: scale(0.96); }

.btn-edit {
  background: rgba(124, 92, 191, 0.15);
  color: var(--accent-lt);
}
.btn-edit:hover { background: rgba(124, 92, 191, 0.28); }

.btn-delete {
  background: rgba(192, 57, 43, 0.12);
  color: #ff7676;
}
.btn-delete:hover { background: rgba(192, 57, 43, 0.25); }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
}

.modal-box h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-lt);
  margin-bottom: 1rem;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); }

/* ── Notification banner ── */
#notif-banner {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
#notif-banner p { font-size: 0.85rem; color: var(--text-dim); flex: 1; }
#btn-allow-notif {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
#notif-banner.hidden { display: none; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
