/* =============================================
   ABC Stars — Football Academy Stylesheet
   (dark-navy sidebar, white header, green primary)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  /* Primary palette — green */
  --primary:          #16A34A;
  --primary-dark:     #15803D;
  --primary-light:    #DCFCE7;
  --primary-mid:      #86EFAC;
  --primary-hover:    #22C55E;

  /* Secondary / success */
  --success:          #059669;
  --success-light:    #D1FAE5;
  --success-mid:      #6EE7B7;

  /* Warning */
  --warning:          #D97706;
  --warning-light:    #FEF3C7;
  --warning-mid:      #FCD34D;

  /* Danger */
  --danger:           #DC2626;
  --danger-light:     #FEE2E2;
  --danger-mid:       #FCA5A5;

  /* Teal accent for progress states */
  --teal:             #0891B2;
  --teal-light:       #CFFAFE;

  /* Text */
  --text-primary:     #0F172A;
  --text-secondary:   #475569;
  --text-muted:       #94A3B8;
  --text-on-dark:     #F8FAFC;

  /* Backgrounds */
  --bg-page:          #F1F5F9;
  --bg-white:         #FFFFFF;
  --bg-subtle:        #F8FAFC;

  /* Borders */
  --border-light:     #E2E8F0;
  --border-mid:       #CBD5E1;
  --border-strong:    #94A3B8;

  /* Sidebar — dark navy */
  --sidebar-bg:       #0F2D4A;
  --sidebar-accent:   #86EFAC;
  --sidebar-accent-strong: #4ADE80;
  --sidebar-hover:    rgba(255,255,255,0.08);
  --sidebar-active:   rgba(255,255,255,0.12);
  --sidebar-border:   rgba(255,255,255,0.07);
  --sidebar-text:     rgba(255,255,255,0.72);
  --sidebar-text-dim: rgba(255,255,255,0.38);
  --sidebar-text-act: #FFFFFF;

  /* Layout */
  --sidebar-w:        260px;
  --header-h:         60px;

  /* Shape */
  --radius-sm:        6px;
  --radius-md:        10px;
  --radius-lg:        14px;
  --radius-xl:        18px;

  /* Shadows — lighter, clinical */
  --shadow-xs:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:        0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg:        0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);

  --transition:       0.18s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* =============================================
   LAYOUT
   ============================================= */

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

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition), width 0.22s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--header-h);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand .brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-on-dark);
  letter-spacing: 0.01em;
}

.sidebar-brand .brand-name span {
  color: var(--sidebar-accent);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-text-dim);
  padding: 12px 10px 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-link i {
  width: 17px;
  text-align: center;
  font-size: 0.88rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-act);
}

.nav-link:hover i {
  opacity: 1;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-act);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  background: var(--sidebar-accent-strong);
  border-radius: 0 3px 3px 0;
}

.nav-link.active i {
  opacity: 1;
  color: var(--sidebar-accent);
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.76rem;
  color: var(--sidebar-text-dim);
  flex-shrink: 0;
}

.sidebar-footer span {
  display: block;
  font-size: 0.68rem;
  margin-top: 2px;
  color: var(--sidebar-text-dim);
}

/* ---- Main Content Area ---- */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.22s ease;
}

/* App shell: lock the document so the sidebar/header keep their fixed spots
   when the on-screen keyboard opens — only .main-area scrolls.
   The .app-shell class is added on <html> and <body> by includes/sidebar.php. */
html.app-shell {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.app-shell {
  /* position:fixed, not just overflow:hidden — iOS Safari still pans the
     document to reveal a focused input when overflow is hidden, dragging
     the (temporarily document-anchored) fixed sidebar up with it. A fixed
     body makes the document truly unscrollable, so Safari scrolls
     .main-area instead. */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.app-shell .main-area {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

@media print {
  html.app-shell,
  body.app-shell,
  body.app-shell .main-area {
    height: auto;
    overflow: visible;
  }
  body.app-shell {
    position: static;
  }
}

/* ---- Top Header ---- */
.top-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  box-shadow: var(--shadow-xs);
  transition: left 0.22s ease;
}

.header-left {
  display: flex;
  flex-direction: column;
}

.header-page-title {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-breadcrumb {
  font-size: 0.71rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-date {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge.doctor {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary-mid);
}

.role-badge.secretary {
  background: var(--warning-light);
  color: #92400E;
  border: 1px solid #FDE68A;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.80rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover {
  background: var(--danger-light);
  border-color: #FECACA;
  color: var(--danger);
}

/* ---- Page Content ---- */
.page-content {
  margin-top: var(--header-h);
  padding: 26px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-header p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* =============================================
   COMPONENTS
   ============================================= */

/* ---- Cards ---- */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.card-title {
  font-size: 0.90rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

.card-title i {
  color: var(--primary);
  font-size: 0.88rem;
}

.card-body {
  padding: 20px;
}

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.stat-card-info {
  flex: 1;
}

.stat-card-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.stat-card-value {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 7px;
}

.stat-card-trend {
  font-size: 0.74rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card-trend.up      { color: var(--success); }
.stat-card-trend.neutral { color: var(--text-muted); }

.stat-card-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.stat-card-icon.blue {
  background: var(--primary-light);
  color: var(--primary);
}
.stat-card-icon.green {
  background: var(--success-light);
  color: var(--success);
}
.stat-card-icon.orange {
  background: var(--warning-light);
  color: var(--warning);
}
.stat-card-icon.red {
  background: var(--danger-light);
  color: var(--danger);
}

/* ---- Dashboard Grid ---- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 18px;
  margin-bottom: 22px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.855rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(22,163,74,0.30);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 3px 10px rgba(22,163,74,0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 1px 3px rgba(5,150,105,0.30);
}

.btn-success:hover {
  background: #047857;
  box-shadow: 0 3px 10px rgba(5,150,105,0.35);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  color: #fff;
  box-shadow: 0 1px 3px rgba(217,119,6,0.30);
}

.btn-warning:hover {
  background: #B45309;
  box-shadow: 0 3px 10px rgba(217,119,6,0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 3px rgba(220,38,38,0.28);
}

.btn-danger:hover {
  background: #B91C1C;
  box-shadow: 0 3px 10px rgba(220,38,38,0.32);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.71rem;
  border-radius: 4px;
}

/* ---- Tables ---- */
.table-container {
  overflow-x: auto;
}

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

thead th {
  background: var(--bg-subtle);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  font-size: 0.865rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  transition: color var(--transition);
}

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

tbody tr:hover {
  background: #F0FDF4;
}

tbody tr:hover td {
  color: var(--text-primary);
}

/* ---- Status Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.70rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
  flex-shrink: 0;
}

.badge-waiting {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.badge-waiting::before {
  animation: pulseDot 1.8s ease-in-out infinite;
}

.badge-progress {
  background: var(--teal-light);
  color: #155E75;
  border: 1px solid #A5F3FC;
}

.badge-done {
  background: var(--success-light);
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.badge-male {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary-mid);
}

.badge-female {
  background: #FDF2F8;
  color: #9D174D;
  border: 1px solid #FBCFE8;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%       { opacity: 0.4;  transform: scale(0.7); }
}

/* ---- Form Controls ---- */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.form-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-row-2 {
  grid-template-columns: repeat(2, 1fr);
}

label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.10);
}

.form-error-msg {
  font-size: 0.72rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-control.error + .form-error-msg {
  display: block;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394A3B8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 34px;
  cursor: pointer;
}

select.form-control option {
  background: #fff;
  color: var(--text-primary);
}

/* ---- Search Bar ---- */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar i {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  font-size: 0.86rem;
  pointer-events: none;
}

.search-bar input {
  padding-left: 34px;
  width: 280px;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  overflow-y: auto;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal-title i {
  color: var(--primary);
}

.modal-close {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
  background: var(--danger-light);
  border-color: #FECACA;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ---- Picture Upload ---- */
.picture-upload-area {
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius-md);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  background: var(--bg-subtle);
}

.picture-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.picture-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.picture-upload-area .upload-icon {
  font-size: 1.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.picture-upload-area p {
  font-size: 0.81rem;
  color: var(--text-secondary);
}

.picture-upload-area p strong {
  color: var(--primary);
}

#picture-preview-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#picture-preview-wrap img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-mid);
  box-shadow: 0 2px 10px rgba(22,163,74,0.18);
}

#picture-preview-wrap span {
  font-size: 0.76rem;
  color: var(--primary);
}

/* ---- Activity Feed ---- */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.activity-dot.blue {
  background: var(--primary-light);
  color: var(--primary);
}
.activity-dot.green {
  background: var(--success-light);
  color: var(--success);
}
.activity-dot.orange {
  background: var(--warning-light);
  color: var(--warning);
}

.activity-text {
  flex: 1;
}

.activity-text strong {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 600;
}

.activity-text p {
  font-size: 0.77rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.activity-time {
  font-size: 0.71rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Queue Specific ---- */
.queue-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.queue-search-row .search-bar {
  flex: 1;
  max-width: 380px;
}

.queue-search-row .search-bar input {
  width: 100%;
}

.queue-stats-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.queue-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  text-transform: uppercase;
}

.pill-total {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border-mid);
}

.pill-waiting {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FDE68A;
}

.pill-progress {
  background: var(--teal-light);
  color: #155E75;
  border-color: #A5F3FC;
}

.pill-done {
  background: var(--success-light);
  color: #065F46;
  border-color: #A7F3D0;
}

.num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
}

.patient-search-results {
  background: var(--bg-white);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-top: -10px;
  margin-bottom: 16px;
  overflow: hidden;
  display: none;
  max-width: 440px;
}

.patient-search-results.visible {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--primary-light);
}

.search-result-item .patient-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-item .patient-meta {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* ---- Role Toggle ---- */
.role-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-subtle);
}

.role-toggle button {
  padding: 6px 14px;
  font-size: 0.80rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}

.role-toggle button.active {
  background: var(--primary);
  color: #fff;
}

.role-toggle button:not(.active):hover {
  background: var(--bg-white);
  color: var(--text-primary);
}

/* ---- Section Dividers ---- */
.section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* ---- Patient Avatar ---- */
.patient-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  border: 1px solid var(--primary-mid);
}

.patient-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Empty States ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state i {
  font-size: 2.2rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: block;
  opacity: 0.6;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ---- Toast Notification ---- */
#toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.865rem;
  min-width: 260px;
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.success {
  border-left: 3px solid var(--success);
}
.toast.warning {
  border-left: 3px solid var(--warning);
}
.toast.error {
  border-left: 3px solid var(--danger);
}
.toast.info {
  border-left: 3px solid var(--primary);
}

@keyframes toastIn {
  from { transform: translateX(36px) scale(0.96); opacity: 0; }
  to   { transform: translateX(0) scale(1);  opacity: 1; }
}

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-264px) translateZ(0); }
  .sidebar.open { transform: translateX(0) translateZ(0); --sidebar-w: 264px; }
  .top-header { left: 0; }
  .main-area { margin-left: 0; }
  .page-content { padding: 16px; }
  .form-row-3, .form-row-2 { grid-template-columns: 1fr; }
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.30s ease both;
}

.stats-grid .stat-card:nth-child(1) { animation: fadeIn 0.35s ease 0.04s both; }
.stats-grid .stat-card:nth-child(2) { animation: fadeIn 0.35s ease 0.10s both; }
.stats-grid .stat-card:nth-child(3) { animation: fadeIn 0.35s ease 0.16s both; }
.stats-grid .stat-card:nth-child(4) { animation: fadeIn 0.35s ease 0.22s both; }

/* ---- Utility ---- */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.8rem; }
.fw-600       { font-weight: 600; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }

/* ── Voice Transcription ─────────────────────────────────────────────────── */
.voice-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mic-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.mic-btn.recording {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
  animation: mic-pulse 1s ease-in-out infinite;
}
.mic-btn.processing {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--warning);
  cursor: not-allowed;
}
@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* Floating recording badge */
.voice-badge {
  display: none;
  position: fixed;
  bottom: 88px;
  right: 24px;
  background: var(--danger);
  color: #fff;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
  pointer-events: none;
}
.voice-badge.visible { display: flex; }
.w-full       { width: 100%; }

/* ── Sidebar toggle button (in top header) ───────────────────────────────── */
.sidebar-toggle-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Mobile overlay behind sidebar */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
#sidebar-overlay.active { display: block; }

/* ── Sidebar collapsed state ─────────────────────────────────────────────── */
body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .sidebar-user-text,
body.sidebar-collapsed .sidebar-footer-links { display: none; }

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}
body.sidebar-collapsed .sidebar-nav {
  padding: 16px 6px;
  overflow: visible;
}
body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 10px;
  gap: 0;
}
body.sidebar-collapsed .nav-link i {
  width: auto;
  font-size: 1rem;
  opacity: 1;
}
body.sidebar-collapsed .sidebar-footer > div {
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
body.sidebar-collapsed .sidebar-user-avatar { margin: 0; }

/* Tooltip labels when collapsed */
body.sidebar-collapsed .nav-link::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1E293B;
  color: #F8FAFC;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 300;
}
body.sidebar-collapsed .nav-link:hover::after { opacity: 1; }

/* ---- Schedule Calendar ---- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-weekday {
  padding: 10px 8px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}
.cal-cell {
  min-height: 110px;
  padding: 6px 6px 8px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.cal-outside { background: var(--bg-subtle); }
.cal-cell.cal-outside .cal-daynum { color: var(--text-muted); }
.cal-cell.cal-today { background: var(--primary-light); }
.cal-daynum {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.cal-cell.cal-today .cal-daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
}
.cal-pill {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 2px 6px;
  border-radius: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-decoration: none;
  border-left: 3px solid transparent;
}
/* Each event id gets a stable color from this palette, so the same event
   reads as the same color across every day it spans; status is layered on
   top via an icon (completed/cancelled) rather than by recoloring the pill. */
.cal-color-1 { background: #DBEAFE; color: #1D4ED8; border-left-color: #3B82F6; }
.cal-color-2 { background: #EDE9FE; color: #6D28D9; border-left-color: #8B5CF6; }
.cal-color-3 { background: #FFEDD5; color: #C2410C; border-left-color: #F97316; }
.cal-color-4 { background: #FCE7F3; color: #BE185D; border-left-color: #EC4899; }
.cal-color-5 { background: #CCFBF1; color: #0F766E; border-left-color: #14B8A6; }
.cal-color-6 { background: #E0E7FF; color: #4338CA; border-left-color: #6366F1; }
.cal-color-7 { background: #FEF3C7; color: #B45309; border-left-color: #F59E0B; }
.cal-color-8 { background: #CFFAFE; color: #0E7490; border-left-color: #06B6D4; }
.cal-pill-cancelled { opacity: .55; text-decoration: line-through; }
.cal-more {
  font-size: .66rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 1px 6px;
  cursor: default;
}
.cal-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  font-weight: 600;
  color: var(--text-muted);
}
.cal-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
@media (max-width: 768px) {
  .cal-cell { min-height: 70px; }
  .cal-pill { font-size: .6rem; }
}
