:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --sidebar-w: 252px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform 0.2s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: grid; place-items: center;
  font-size: 20px;
}
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #ffffff;
  padding: 2px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-title { font-weight: 600; font-size: 14px; line-height: 1.3; color: #fff; }
.brand-sub { font-size: 11px; color: #94a3b8; }

.nav-list {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 400;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: #2563eb; color: #fff; font-weight: 500; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 6px; }

.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.storage-badge { font-size: 11px; color: #94a3b8; }
.sidebar-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-ghost-sm {
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  border: none;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
}
.btn-ghost-sm:hover { background: rgba(255,255,255,0.16); }
.btn-ghost-sm.danger:hover { background: rgba(220,38,38,0.35); color: #fecaca; }

/* Main area */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.mobile-menu-btn {
  display: none;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
}
.page-title { margin: 0; font-size: 19px; font-weight: 600; }
.page-subtitle { margin: 0; font-size: 12px; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.today-pill {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.content {
  padding: 20px 24px 40px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 15px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 13px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--surface-alt); }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.btn-icon:hover { background: var(--surface-alt); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-bar {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}
.filter-item { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.filter-item label { font-size: 11.5px; font-weight: 600; color: #1e3a8a; }
.filter-item select, .filter-item input {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-item select:focus, .filter-item input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--primary));
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 700; margin: 4px 0 2px; line-height: 1.15; }
.kpi-sub { font-size: 11.5px; color: var(--text-muted); }

.dashboard-mid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  gap: 10px;
}
.avatar-lg {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 3px solid var(--primary);
  background: var(--surface-alt);
}
.avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
}
.profile-name { font-weight: 600; font-size: 15px; }
.profile-stat { font-size: 12px; color: var(--text-muted); }

/* Horizontal bar charts */
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar-meta { display: flex; justify-content: space-between; font-size: 12.5px; }
.bar-track { height: 9px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.3s ease; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
tr:hover td { background: #f8fafc; }

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.status-ยืนยันแล้ว { background: #dcfce7; color: #166534; }
.status-รอยืนยัน { background: #fef9c3; color: #854d0e; }
.status-เลื่อน { background: #ffedd5; color: #9a3412; }
.status-ยกเลิก { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.status-เสร็จสิ้น { background: #e0e7ff; color: #3730a3; }
.status-ไม่ได้เข้าร่วม { background: #f1f5f9; color: #475569; }

/* Calendar */
.cal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.cal-dow {
  background: var(--surface-alt);
  padding: 8px 6px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  min-width: 0;
  min-height: 112px;
  padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.12s;
}
.cal-cell:hover { background: #f8fafc; }
.cal-cell.other-month { background: #fafafa; color: #94a3b8; }
.cal-cell.selected { background: #eff6ff; box-shadow: inset 0 0 0 2px var(--primary); }
.cal-cell.is-today .cal-day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
}
.cal-day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.cal-day-num { font-size: 12px; font-weight: 600; }
.cal-holiday {
  font-size: 10.5px;
  background: #fef2f2;
  color: #b91c1c;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event {
  font-size: 11px;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-more { font-size: 11px; color: var(--primary); font-weight: 500; padding-left: 2px; }

/* Weekly Matrix */
.weekly-table th.member-th {
  color: #fff;
  text-align: center;
  min-width: 180px;
}
.weekly-member-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
}
.weekly-cell {
  vertical-align: top;
  min-width: 170px;
  background: #fff;
}
.weekly-item {
  border-left: 3px solid var(--primary);
  background: var(--surface-alt);
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
}
.weekly-item:hover { background: #eef2ff; }
.weekly-time { font-weight: 600; font-size: 11px; color: var(--text-muted); }
.weekly-title { font-weight: 500; margin: 2px 0; }
.weekly-loc { font-size: 11px; color: var(--text-muted); }

/* Checklist */
.chk-cell-disabled {
  background: #f1f5f9 !important;
  color: #94a3b8;
  text-align: center;
}
.chk-cell-active { text-align: center; }
.chk-box {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}
.doc-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
}
.doc-pill:hover { background: #e2e8f0; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: grid; place-items: center;
  z-index: 100;
  padding: 16px;
}
.modal-backdrop.hidden { display: none; }
.modal-card {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal-card.modal-lg { max-width: 720px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-close {
  background: transparent; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted);
}
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-sub { margin: 0 0 12px; font-weight: 500; color: var(--primary); }
.modal-footer {
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.form-group .hint { font-weight: 400; font-size: 11px; }
.form-group input, .form-group select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
}

/* Toast */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
}
.toast {
  background: #0f172a; color: #fff;
  padding: 10px 16px; border-radius: 9px;
  font-size: 13px; box-shadow: var(--shadow-md);
}

.cal-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-mid, .cal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-menu-btn { display: inline-block; }
  .topbar { padding: 10px 14px; }
  .page-title { font-size: 16px; }
  .page-subtitle { display: none; }
  .content { padding: 14px 12px 32px; }
  .filter-item { flex: 1 1 140px; min-width: 0; }
  .charts-grid, .cmp-grid { grid-template-columns: 1fr !important; }
  .cal-grid { min-width: 720px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
  .today-pill { display: none; }
}

/* Hover Appointment Tooltip */
.appt-tooltip {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  width: 310px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text);
}
.appt-tooltip.hidden { display: none; }
.appt-tt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.appt-tt-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.35;
  margin-bottom: 8px;
}
.appt-tt-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
}
.appt-tt-meta strong { color: var(--text); font-weight: 500; }

/* Pie Chart */
.pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.pie-svg {
  width: 176px;
  height: 176px;
  flex-shrink: 0;
}
.pie-svg path, .pie-svg circle {
  transition: opacity 0.15s;
  cursor: pointer;
}
.pie-svg path:hover, .pie-svg circle:hover {
  opacity: 0.85;
}
.pie-legend {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.pie-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.pie-legend-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.pie-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pie-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pie-val {
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}

/* Dashboard Enhancements */
.dashboard-mid.no-profile {
  grid-template-columns: 1fr;
}
.clickable-row {
  cursor: pointer;
}
.clickable-row:hover td {
  background: #eff6ff !important;
}
.bar-row.interactive,
.pie-legend-row.interactive {
  cursor: pointer;
  padding: 3px 5px;
  margin: -3px -5px;
  border-radius: 6px;
  transition: background 0.12s;
}
.bar-row.interactive:hover,
.pie-legend-row.interactive:hover {
  background: #f1f5f9;
}
.bar-row.interactive.active-filter,
.pie-legend-row.interactive.active-filter {
  background: #eff6ff;
  outline: 1px solid #bfdbfe;
}
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.agenda-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: background 0.12s;
}
.agenda-item:hover {
  background: #eff6ff;
}

/* Attachments in Appointment Modal */
.attach-box {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
}
.attach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 6px 12px;
}
.attach-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.attach-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.attach-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.attach-list:empty {
  display: none;
}
.attach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.attach-name-input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px !important;
  font-size: 12.5px !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
}
.attach-size {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Comparison Grouped Bar Chart */
.cmp-legend {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.cmp-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
}
.cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px 24px;
}
.cmp-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-top: 3px solid var(--primary);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.cmp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
}
.cmp-row {
  display: grid;
  grid-template-columns: 70px 1fr 60px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.cmp-track {
  height: 12px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.cmp-fill-sel {
  height: 100%;
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.cmp-fill-team {
  height: 100%;
  background: linear-gradient(90deg, #d97706, #fbbf24);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.cmp-val {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

/* Participant Filter Chips (Calendar) */
.person-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, color 0.12s;
}
.person-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}
.person-chip.active {
  background: var(--chip-color, var(--primary));
  border-color: var(--chip-color, var(--primary));
  color: #ffffff;
}
.person-chip-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-weekly {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 3px solid #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
  background: #ffffff;
}

/* Bullet Chart & Team Secretary Comparison */
.bullet-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bullet-row {
  display: grid;
  grid-template-columns: 160px 1fr 185px;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.bullet-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.bullet-track {
  position: relative;
  height: 16px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: visible;
}
.bullet-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.bullet-target {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  background: #d97706;
  border-radius: 2px;
  box-shadow: 0 0 0 2px #fff;
  transform: translateX(-50%);
  z-index: 2;
}
.bullet-vals {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12.5px;
  white-space: nowrap;
}
.team-cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}
.team-cmp-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.team-cmp-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}
.team-cmp-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 768px) {
  .bullet-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .bullet-vals {
    justify-content: space-between;
  }
}

/* ==================== PRINT / PDF EXPORT ==================== */
@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body {
    background: #ffffff !important;
  }
  .sidebar,
  .topbar-right,
  .mobile-menu-btn,
  .modal-backdrop,
  .appt-tooltip,
  .filter-bar,
  .person-chips,
  .btn-primary,
  .btn-secondary,
  .btn-ghost-sm,
  .btn-icon {
    display: none !important;
  }
  .app-shell {
    display: block !important;
  }
  .main-area {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .topbar {
    position: static !important;
    padding: 0 0 10px 0 !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 12px !important;
    background: #ffffff !important;
  }
  .content {
    padding: 0 !important;
  }
  .card,
  .kpi-card,
  .weekly-item,
  .team-cmp-card {
    box-shadow: none !important;
    break-inside: avoid;
  }
  .table-wrap {
    overflow: visible !important;
  }
  table {
    font-size: 11px !important;
  }
}
