:root {
  --primary: #6C5CE7;
  --primary-dark: #5849c2;
  --primary-light: #efecfd;
  --secondary: #00CEC9;
  --success: #12b76a;
  --warning: #f59e0b;
  --danger: #f04438;
  --info: #3b82f6;
  --bg: #f6f5fb;
  --card-bg: #ffffff;
  --text: #1e1b3a;
  --text-muted: #6b7280;
  --border: #ece9f7;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(30, 27, 58, 0.06);
  --shadow-md: 0 8px 24px rgba(30, 27, 58, 0.08);
  --shadow-lg: 0 16px 40px rgba(30, 27, 58, 0.12);
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

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

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; }

a { text-decoration: none; }

/* ============ AUTH ============ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #7c6cf0 0%, #6C5CE7 40%, #4d3fc7 100%);
  padding: 20px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 8px; }
.auth-logo {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; margin: 0 auto 16px;
  box-shadow: 0 10px 24px rgba(108, 92, 231, 0.35);
}
.auth-brand h1 { font-size: 24px; margin-bottom: 2px; }
.auth-brand p { color: var(--text-muted); font-size: 13px; margin: 0; }

/* ============ LAYOUT ============ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: #191233;
  color: #cfc9f0;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform 0.25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .logo-box {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.sidebar-brand .brand-text { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-brand .brand-text small { display:block; font-weight:400; font-size: 11px; color: #8b83b8; }

.sidebar-nav { padding: 14px 12px; }
.sidebar-nav .nav-link {
  color: #b3acd6; padding: 11px 14px; border-radius: 10px;
  display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500;
  margin-bottom: 4px; transition: all .15s ease;
}
.sidebar-nav .nav-link i { font-size: 17px; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav .nav-link.active {
  background: linear-gradient(135deg, var(--primary), #7c6cf0);
  color: #fff; box-shadow: 0 6px 16px rgba(108,92,231,0.35);
}
.sidebar-section-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: #6f6795; padding: 16px 14px 6px;
}

.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.08);
  position: sticky; bottom: 0; background: #191233;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-chip .u-name { font-size: 13px; color: #fff; font-weight: 600; margin: 0; }
.user-chip .u-role { font-size: 11px; color: #8b83b8; text-transform: capitalize; }

.main-content { margin-left: 250px; flex: 1; min-width: 0; padding: 24px 28px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.topbar h2 { font-size: 22px; margin: 0; }
.topbar .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.sidebar-toggle-btn { display: none; }

/* ============ CARDS ============ */
.card-soft {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card .icon-box {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; margin-bottom: 14px;
}
.stat-card .stat-value { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-card .stat-label { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }
.stat-card .stat-trend { font-size: 12px; font-weight: 600; margin-top: 8px; }

.bg-grad-purple { background: linear-gradient(135deg, #6C5CE7, #8b7ef7); }
.bg-grad-teal { background: linear-gradient(135deg, #00CEC9, #22e0d8); }
.bg-grad-amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.bg-grad-green { background: linear-gradient(135deg, #12b76a, #32d583); }
.bg-grad-red { background: linear-gradient(135deg, #f04438, #f87168); }
.bg-grad-blue { background: linear-gradient(135deg, #3b82f6, #60a5fa); }

/* ============ BADGES ============ */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-blocked { background: #fef3e8; color: #b45309; }
.status-confirmed { background: #e8f0fe; color: #1d4ed8; }
.status-completed { background: #e7f9f0; color: #087443; }
.status-cancelled { background: #fde8e8; color: #b91c1c; }

.shift-badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 600;
}
.shift-day { background: #fff7e0; color: #92720b; }
.shift-evening { background: #efeafd; color: #5b3fc4; }
.shift-full { background: #e0f7f5; color: #0b7d78; }

/* ============ CALENDAR ============ */
.calendar-wrap { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 18px; }
.fc { font-family: 'Poppins', sans-serif; }
.fc .fc-toolbar-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.fc .fc-button-primary {
  background: var(--primary-light); border-color: var(--primary-light); color: var(--primary);
  font-weight: 600; font-size: 13px; box-shadow: none !important;
  border-radius: 10px !important;
}
.fc .fc-button-primary:hover { background: var(--primary); color: #fff; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fc-toolbar-chunk .fc-button-group { gap: 2px; }

.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border); }
.fc-col-header-cell { padding: 10px 0; background: #faf9fd; }
.fc-col-header-cell-cushion {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); text-decoration: none !important; padding: 6px 0;
}

.fc-daygrid-day { transition: background .15s ease; }
.fc-daygrid-day-frame { min-height: 92px; padding: 4px; }
.fc-daygrid-day.fc-day-today { background: var(--primary-light) !important; }
.fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
  background: var(--primary); color: #fff;
}

.fc-daygrid-day-top { flex-direction: row; padding: 6px 6px 0; }
.fc-daygrid-day-number {
  font-size: 19px; font-weight: 800; color: var(--text);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; text-decoration: none !important;
}
.fc-day-other .fc-daygrid-day-number { color: #c9c5df; font-weight: 600; }

.fc-daygrid-day.cal-day-available:hover { background: var(--primary-light); cursor: pointer; }
.fc-daygrid-day.cal-day-booked { background: #fbfaff; }
.fc-daygrid-day.cal-day-booked .fc-daygrid-day-number { background: #efecfd; }
.fc-daygrid-day.cal-day-full .fc-daygrid-day-number { background: #e7f9f0; color: #087443; }

.fc-event { border-radius: 7px; border: none; padding: 2px 6px; font-size: 11.5px; font-weight: 600; cursor: pointer; margin-top: 2px !important; }
.fc-daygrid-event-dot { display: none; }
.fc-daygrid-more-link { font-size: 11px; font-weight: 700; color: var(--primary); }

.cal-legend {
  display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 14px 16px; margin-bottom: 16px;
  background: #faf9fd; border: 1px solid var(--border); border-radius: 12px;
}
.cal-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.cal-legend-swatch { width: 14px; height: 14px; border-radius: 5px; flex-shrink: 0; }

.border-dashed { border-style: dashed !important; background: #fcfbff; }

.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ============ MINI CALENDAR GRID (6-month overview) ============ */
.mini-cal-grid-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 991px) {
  .mini-cal-grid-wrap { grid-template-columns: minmax(0, 1fr); }
}

.mini-cal-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px;
  min-width: 0;
}
.mini-cal-title {
  font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 12px; text-align: center;
}
.mini-cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 6px;
}
.mini-cal-weekdays span {
  text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase;
}
.mini-cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
  min-width: 0;
}
.mini-cal-cell {
  aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer; position: relative; transition: transform .1s ease;
  background: #ffffff; border: 1px solid #f1eff8;
}
.mini-cal-cell:hover { transform: scale(1.08); z-index: 2; box-shadow: var(--shadow-md); }
.mini-cal-blank { visibility: hidden; cursor: default; }
.mini-cal-blank:hover { transform: none; box-shadow: none; }

.mini-cal-num { font-size: 17px; font-weight: 800; color: var(--text); line-height: 1; }
.mini-cal-icons { font-size: 10px; line-height: 1; margin-top: 3px; display: flex; gap: 1px; }

.mini-cal-available { background: #ffffff; }
.mini-cal-available:hover { background: var(--primary-light); }

.mini-cal-confirmed { background: #3b82f6; border-color: #3b82f6; }
.mini-cal-confirmed .mini-cal-num { color: #ffffff; }

.mini-cal-blocked { background: #f59e0b; border-color: #f59e0b; }
.mini-cal-blocked .mini-cal-num { color: #ffffff; }

.mini-cal-completed { background: #12b76a; border-color: #12b76a; }
.mini-cal-completed .mini-cal-num { color: #ffffff; }

.mini-cal-today { outline: 2px solid var(--primary-dark); outline-offset: 1px; }
.mini-cal-today.mini-cal-available .mini-cal-num { color: var(--primary-dark); }

@media (max-width: 575px) {
  .mini-cal-num { font-size: 15px; }
  .mini-cal-icons { font-size: 9px; }
  .mini-cal-title { font-size: 14px; }
}

/* ============ TABLE ============ */
.table-modern thead th {
  background: #faf9fd; border-bottom: 2px solid var(--border);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 700; padding: 12px 14px; white-space: nowrap;
}
.table-modern tbody td { padding: 13px 14px; vertical-align: middle; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.table-modern tbody tr:hover { background: #faf9ff; }
.table-modern tbody tr:last-child td { border-bottom: none; }

.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), #ded7fb);
  color: var(--primary-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

/* ============ FORMS / BUTTONS ============ */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-soft-primary { background: var(--primary-light); color: var(--primary-dark); border: none; font-weight: 600; }
.btn-soft-primary:hover { background: var(--primary); color: #fff; }
.btn-wa { background: #25D366; color: #fff; border: none; font-weight: 600; }
.btn-wa:hover { background: #1ea952; color: #fff; }

.form-control, .form-select { border-radius: 10px; border-color: var(--border); font-size: 13.5px; padding: 9px 12px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-label { font-size: 12.5px; font-weight: 600; color: #4b4470; margin-bottom: 5px; }

.filter-pill {
  border: 1px solid var(--border); background: #fff; border-radius: 30px;
  padding: 7px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.filter-pill.active, .filter-pill:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.search-box { position: relative; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input { padding-left: 38px; border-radius: 30px; }

/* ============ MODAL ============ */
.modal-content { border-radius: 20px; border: none; }
.modal-header { border-bottom: 1px solid var(--border); padding: 20px 24px; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); font-weight: 700; margin: 18px 0 10px; display:flex; align-items:center; gap:6px; }
.section-title:first-child { margin-top: 0; }

.day-cell-badges { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }

.balance-box { background: var(--primary-light); border-radius: 12px; padding: 16px; }
.balance-box .row > div { text-align: center; }
.balance-box .lbl { font-size: 11px; color: var(--text-muted); }
.balance-box .val { font-size: 16px; font-weight: 700; }

/* ============ RESPONSIVE ============ */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.3); }
  .main-content { margin-left: 0; padding: 16px 14px 50px; }
  .sidebar-toggle-btn { display: inline-flex; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1020; }
  .sidebar-overlay.show { display: block; }
  .topbar h2 { font-size: 19px; }
}

@media (max-width: 575px) {
  .stat-card .stat-value { font-size: 21px; }
  .auth-card { padding: 30px 22px; }
}
