:root {
  --primary: #1a1a2e;
  --primary-light: #16213e;
  --accent: #e94560;
  --accent2: #0f3460;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e0e0e0;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: var(--primary); color: white;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
  height: 100vh; overflow-y: auto; z-index: 100;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-icon { font-size: 28px; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sub { font-size: 10px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1px; }
.nav-menu { list-style: none; padding: 12px 0; flex: 1; }
.nav-menu li { margin: 2px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.75); text-decoration: none;
  font-size: 13.5px; font-weight: 500; transition: all 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { background: var(--accent); color: white; }
.sidebar-footer { padding: 12px 16px; font-size: 11px; color: rgba(255,255,255,0.3); text-align: center; border-top: 1px solid rgba(255,255,255,0.08); }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--primary); }
.page-subtitle { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* CARDS */
.card { background: var(--card); border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border: 1px solid var(--border); }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid var(--accent); }
.stat-card.green { border-left-color: var(--success); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.blue { border-left-color: var(--info); }
.stat-label { font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* GRID LAYOUT */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #c0392b; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e0e0e0; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219a52; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: white; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { background: var(--primary); color: white; padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
tr:hover td { background: #fafafa; }
tr:last-child td { border-bottom: none; }

/* BADGES */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-confirmado, .badge-aceptado, .badge-realizado { background: #d5f5e3; color: #1e8449; }
.badge-reservado, .badge-enviado { background: #fef9e7; color: #b7770d; }
.badge-borrador { background: #eaecee; color: #7f8c8d; }
.badge-rechazado, .badge-cancelado { background: #fdedec; color: #c0392b; }
.badge-facturado { background: #d6eaf8; color: #1a5276; }
.badge-ayuntamiento { background: #d6eaf8; color: #1a5276; }
.badge-particular { background: #e8daef; color: #6c3483; }
.badge-empresa { background: #d5f5e3; color: #1e8449; }
.badge-espectaculo { background: #fde8d8; color: #a04000; }
.badge-formacion_propia { background: #d5f5e3; color: #1e8449; }
.badge-formacion_contratada { background: #fef9e7; color: #b7770d; }

/* FORMS */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.4px; }
input, select, textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text);
  background: white; transition: border 0.15s; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

/* AGENDA CALENDAR */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-header { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-light); text-transform: uppercase; padding: 6px 0; }
.cal-day {
  min-height: 90px; background: white; border-radius: 8px;
  border: 1.5px solid var(--border); padding: 6px;
  cursor: pointer; transition: border 0.15s;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.today { border-color: var(--accent); background: #fff5f5; }
.cal-day.otro-mes { background: #f8f8f8; opacity: 0.5; }
.cal-day-num { font-size: 12px; font-weight: 700; color: var(--text-light); margin-bottom: 4px; }
.cal-day.today .cal-day-num { color: var(--accent); }
.cal-event {
  font-size: 10px; border-radius: 4px; padding: 2px 5px;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: white; font-weight: 600; cursor: pointer;
}
.cal-event.confirmado { background: var(--success); }
.cal-event.reservado { background: var(--warning); }
.cal-event.realizado { background: var(--info); }
.cal-event.cancelado { background: #bdc3c7; }

/* MODAL */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 16px; padding: 28px;
  width: 90%; max-width: 620px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-light); }

/* LEYENDA */
.leyenda { display: flex; gap: 16px; align-items: center; }
.ley-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.ley-dot { width: 12px; height: 12px; border-radius: 3px; }
.ley-dot.confirmado { background: var(--success); }
.ley-dot.reservado { background: var(--warning); }
.ley-dot.realizado { background: var(--info); }

/* SEARCH */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px; color: var(--text-light); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* SIDEBAR USER */
.sidebar-user {
  padding: 12px; border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: auto;
}
.user-info {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.user-avatar {
  width: 34px; height: 34px; background: var(--accent);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-rol { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 1px; }
.btn-logout {
  display: block; text-align: center; padding: 7px;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6);
  border-radius: 6px; font-size: 12px; text-decoration: none;
  transition: all 0.15s;
}
.btn-logout:hover { background: rgba(233,69,96,0.3); color: white; }

/* NETWORK BANNER */
.net-banner {
  background: linear-gradient(135deg, #0f3460, #1a237e);
  color: white; border-radius: 10px; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 20px; font-size: 13px;
}
.net-url {
  font-family: monospace; font-size: 15px; font-weight: 700;
  background: rgba(255,255,255,0.15); padding: 4px 12px;
  border-radius: 6px; letter-spacing: 0.5px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
