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

:root {
  --primary: #1a1a2e;
  --accent:  #C9A96E;
  --success: #28a745;
  --warning: #ffc107;
  --danger:  #dc3545;
  --muted:   #6c757d;
  --border:  #e0e0e0;
  --bg:      #f8f9fa;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: #333;
  font-size: 14px;
}

/* ── LOGIN ─────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  text-align: center;
}

.login-box h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.login-box p {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 13px;
}

.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 12px;
}

.login-box input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-box button {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.login-box .error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

/* ── APP SHELL ──────────────────────────────────── */
#app {
  display: none;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--primary);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar__logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar__logo h2 {
  font-size: 18px;
  color: var(--accent);
}

.sidebar__logo small {
  font-size: 11px;
  opacity: 0.6;
}

.sidebar__nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.sidebar__nav a:hover,
.sidebar__nav a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar__nav a.active {
  border-left: 3px solid var(--accent);
}

.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  opacity: 0.6;
}

.main {
  margin-left: 220px;
  padding: 24px;
  min-height: 100vh;
}

/* ── TOPBAR ─────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 700;
}

.topbar__controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── FILTROS ─────────────────────────────────────── */
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filters input,
.filters select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

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

/* ── TABLA ──────────────────────────────────────── */
.table-wrap {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #fafafa; }

/* ── BADGES ─────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--pending   { background: #fff3cd; color: #856404; }
.badge--confirmed { background: #d1e7dd; color: #0f5132; }
.badge--cancelled { background: #f8d7da; color: #721c24; }
.badge--completed { background: #cfe2ff; color: #084298; }
.badge--no_show   { background: #e2e3e5; color: #41464b; }

/* ── ACCIONES ────────────────────────────────────── */
.action-btns {
  display: flex;
  gap: 6px;
}

.btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.8; }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn--success  { background: var(--success); color: #fff; }
.btn--danger   { background: var(--danger);  color: #fff; }
.btn--warning  { background: var(--warning); color: #333; }
.btn--muted    { background: #e9ecef;        color: #333; }
.btn--primary  { background: var(--primary); color: #fff; }

/* ── LOADING / EMPTY ────────────────────────────── */
.state-msg {
  text-align: center;
  padding: 48px;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── MODAL ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal h2 { font-size: 18px; margin-bottom: 16px; }

.modal-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.modal-row:last-of-type { border-bottom: none; }

.modal-row span:first-child { color: var(--muted); min-width: 120px; }

.modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.modal__close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
}

/* ── CLIENTES ────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .main { margin-left: 0; padding: 16px; }
}
