/* ========== RESET & BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: #f1f5f9; color: #1e293b; font-size: 14px; line-height: 1.5; }
a { color: #3b82f6; text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ========== SIDEBAR ========== */
.sidebar { width: 220px; background: #1e293b; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 20px 16px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid #334155; display: flex; align-items: center; gap: 10px; }
.sidebar-logo img, .sidebar-logo .logo-icon { width: 28px; height: 28px; border-radius: 6px; background: #3b82f6; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: #94a3b8; font-size: 14px; transition: all .15s; }
.sidebar-nav a:hover { color: #fff; background: #334155; text-decoration: none; }
.sidebar-nav a.active { color: #fff; background: #3b82f6; border-radius: 0; }
.sidebar-nav .nav-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }

/* ========== MAIN ========== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ========== TOP BAR ========== */
.topbar { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-org { font-weight: 600; color: #1e293b; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #64748b; }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; background: #3b82f6; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }

/* ========== CONTENT ========== */
.content { padding: 24px; flex: 1; }

/* ========== BREADCRUMB ========== */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #64748b; margin-bottom: 16px; }
.breadcrumb a { color: #3b82f6; }
.breadcrumb .sep { color: #cbd5e1; }

/* ========== 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: #1e293b; }
.page-header-actions { display: flex; gap: 8px; }

/* ========== BUTTONS ========== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; border: none; cursor: pointer; transition: all .15s; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #fff; color: #1e293b; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ========== CARDS ========== */
.card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; }
.card-header { padding: 16px 20px; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ========== FILTERS ========== */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; align-items: center; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 11px; font-weight: 500; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }

/* ========== INPUTS ========== */
input[type="text"], input[type="number"], input[type="date"], input[type="time"],
input[type="datetime-local"], input[type="search"], select, textarea {
  padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px;
  color: #1e293b; background: #fff; outline: none; transition: border .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
textarea { resize: vertical; min-height: 80px; }
.input-sm { padding: 6px 10px; font-size: 12px; }

/* ========== FORM ========== */
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 15px; font-weight: 600; color: #1e293b; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid #e2e8f0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 500; color: #374151; }
.form-label .required { color: #ef4444; }
.form-hint { font-size: 11px; color: #94a3b8; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 20px; border-top: 1px solid #e2e8f0; margin-top: 24px; }

/* ========== TOGGLE ========== */
.toggle { position: relative; width: 40px; height: 22px; background: #cbd5e1; border-radius: 11px; cursor: pointer; display: inline-block; }
.toggle.active { background: #3b82f6; }
.toggle::after { content: ''; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: .15s; }
.toggle.active::after { left: 20px; }

/* ========== TABLE ========== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { background: #f8fafc; padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .3px; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
tbody tr:hover { background: #f8fafc; }
.table-actions { display: flex; gap: 4px; }

/* ========== BADGES ========== */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-terminated { background: #f1f5f9; color: #475569; }
.badge-enabled { background: #d1fae5; color: #065f46; }
.badge-disabled { background: #f1f5f9; color: #475569; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-pending { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-missed { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f1f5f9; color: #475569; }

/* ========== TABS ========== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; margin-bottom: 20px; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 500; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab:hover { color: #1e293b; }
.tab.active { color: #3b82f6; border-bottom-color: #3b82f6; font-weight: 600; }

/* ========== DETAIL HEADER ========== */
.detail-header { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 24px; margin-bottom: 24px; }
.detail-header-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.detail-title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 12px; }
.detail-subtitle { font-size: 14px; color: #64748b; margin-top: 4px; }
.detail-meta { display: flex; gap: 24px; margin-top: 12px; }
.detail-meta-item { font-size: 13px; color: #64748b; }
.detail-meta-item strong { color: #1e293b; font-weight: 600; }

/* ========== MODALS ========== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-lg { max-width: 640px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { width: 28px; height: 28px; border-radius: 6px; border: none; background: none; cursor: pointer; font-size: 18px; color: #64748b; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #f1f5f9; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #e2e8f0; display: flex; gap: 8px; justify-content: flex-end; }

/* ========== ACCORDION ========== */
.accordion { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; }
.accordion-header { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; background: #f8fafc; border-radius: 8px; }
.accordion-header:hover { background: #f1f5f9; }
.accordion-body { padding: 16px; border-top: 1px solid #e2e8f0; }

/* ========== CALENDAR ========== */
.calendar { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.calendar-header { background: #f8fafc; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-day-header { padding: 8px; text-align: center; font-size: 11px; font-weight: 600; color: #64748b; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.calendar-cell { min-height: 80px; padding: 4px; border-right: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; }
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-date { font-size: 12px; font-weight: 500; color: #64748b; padding: 2px 4px; }
.calendar-event { padding: 2px 6px; border-radius: 4px; font-size: 10px; margin-top: 2px; cursor: pointer; }
.calendar-event.pending { background: #dbeafe; color: #1e40af; }
.calendar-event.completed { background: #d1fae5; color: #065f46; }
.calendar-event.missed { background: #fee2e2; color: #991b1b; }
.calendar-event.cancelled { background: #f1f5f9; color: #475569; }

/* ========== PAGINATION ========== */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.pagination-info { font-size: 13px; color: #64748b; }
.pagination-buttons { display: flex; gap: 4px; }
.pagination-btn { padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; font-size: 13px; cursor: pointer; }
.pagination-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.pagination-btn:hover:not(.active) { background: #f8fafc; }

/* ========== MENU 3 DOTS ========== */
.menu-dots { position: relative; display: inline-flex; }
.menu-dots-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: none; cursor: pointer; font-size: 16px; color: #64748b; display: flex; align-items: center; justify-content: center; }
.menu-dots-btn:hover { background: #f1f5f9; }
.menu-dropdown { position: absolute; right: 0; top: 100%; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.1); min-width: 160px; z-index: 50; padding: 4px; }
.menu-dropdown a { display: block; padding: 8px 12px; font-size: 13px; color: #1e293b; border-radius: 6px; }
.menu-dropdown a:hover { background: #f1f5f9; text-decoration: none; }
.menu-dropdown a.danger { color: #ef4444; }

/* ========== INLINE TABLE (time slots, etc) ========== */
.inline-table { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.inline-table table { margin: 0; }
.inline-table thead th { background: #f8fafc; }

/* ========== STAT CARDS ========== */
.stats { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card { flex: 1; background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 16px 20px; }
.stat-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 24px; font-weight: 700; color: #1e293b; margin-top: 4px; }

/* ========== DRAG HANDLE ========== */
.drag-handle { color: #cbd5e1; cursor: grab; font-size: 16px; }

/* ========== RADIO / CHECKBOX ========== */
.radio-group { display: flex; gap: 16px; }
.radio-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.radio-label input { accent-color: #3b82f6; }

/* ========== MONTH TOGGLES ========== */
.month-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.month-toggle { padding: 4px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 12px; cursor: pointer; background: #fff; }
.month-toggle.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stats { flex-direction: column; }
}
