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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active: #6366f1;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

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

/* ── LAYOUT ── */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.sidebar-logo-text { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.3; }
.sidebar-logo-text small { display: block; font-weight: 400; color: var(--sidebar-text); font-size: 11px; }

.sidebar-section { padding: 16px 12px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(199,210,254,.4); }

.sidebar-nav { list-style: none; padding: 0 8px; }
.sidebar-nav li { margin: 2px 0; }
.sidebar-nav a, .sidebar-nav button {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  transition: all .15s; cursor: pointer; width: 100%; border: none; background: none; text-align: left;
}
.sidebar-nav a:hover, .sidebar-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.sidebar-nav .nav-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-nav .badge {
  margin-left: auto; background: rgba(255,255,255,.15); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 20px; min-width: 22px; text-align: center;
}

.sidebar-bottom {
  margin-top: auto; padding: 16px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: rgba(255,255,255,.06); border-radius: 10px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-rol { font-size: 11px; color: var(--sidebar-text); }
.logout-btn { background: none; border: none; color: var(--sidebar-text); cursor: pointer; padding: 4px; border-radius: 6px; transition: color .15s; }
.logout-btn:hover { color: #fff; }

/* ── TOPBAR ── */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 60px;
  display: flex; align-items: center; justify-content: flex-start; gap: 16px;
  position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 0 var(--border);
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── MAIN CONTENT ── */
.main-content { padding: 28px; overflow-x: hidden; }

/* ── CARDS ── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 24px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-value.alta { color: var(--success); }
.stat-value.baixa { color: var(--danger); }
.stat-value.reserva { color: var(--warning); }
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* ── GRID LAYOUT ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
  background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr { transition: background .1s; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

/* ── Columnes ordenables ── */
th.th-sort { cursor: pointer; user-select: none; }
th.th-sort:hover { color: var(--primary); background: #eef2ff; }
th.th-sort .sort-arrow { font-size: 10px; opacity: 0.5; margin-left: 2px; }
th.th-sort:hover .sort-arrow { opacity: 1; }

/* ── Mesos d'assistència ── */
.mesos-check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.mes-check-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.mes-check-label:has(.mes-checkbox:checked) {
    background: #eef2ff;
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 700;
}

.mes-check-label .mes-checkbox {
    display: none;
}

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.badge-alta { background: #d1fae5; color: #065f46; }
.badge-baixa { background: #fee2e2; color: #991b1b; }
.badge-reserva { background: #fef3c7; color: #92400e; }
.badge-admin { background: #e0e7ff; color: #3730a3; }
.badge-staff { background: #f1f5f9; color: #475569; }
.classe-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: #fff;
}

/* ── FILTERS BAR ── */
.filters-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 16px; background: var(--card);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap input { padding-left: 36px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; pointer-events: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: 2px solid var(--border); background: var(--card); color: var(--text-muted); transition: all .15s;
}
.filter-chip.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span-2 { grid-column: span 2; }
label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text); background: var(--card);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
textarea { resize: vertical; min-height: 80px; }
.form-section {
  padding: 16px 20px; border-radius: 10px; margin-bottom: 20px;
}
.form-section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1.5px solid currentColor;
}
.section-idalu { background: #f0f4ff; border: 1px solid #c7d2fe; color: #4338ca; }
.section-infant { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.section-tutor1 { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.section-tutor2 { background: #fef3f2; border: 1px solid #fecaca; color: #991b1b; }
.section-assistencia { background: #f0f9ff; border: 1px solid #bae6fd; color: #075985; }

/* ── CHECKBOX ── */
.checkbox-group { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.checkbox-group label { font-size: 14px; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: 0; cursor: pointer; }

/* ── WIZARD ── */
.wizard-steps { display: flex; margin-bottom: 32px; }
.wizard-step {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative;
}
.wizard-step:not(:last-child)::after {
  content: ''; position: absolute; top: 17px; left: 60%; width: 80%;
  height: 2px; background: var(--border);
}
.wizard-step.done::after, .wizard-step.active::after { background: var(--primary); }
.step-circle {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--card); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted); z-index: 1; transition: all .2s;
}
.wizard-step.active .step-circle { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(99,102,241,.2); }
.wizard-step.done .step-circle { border-color: var(--success); background: var(--success); color: #fff; }
.step-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.wizard-step.active .step-label { color: var(--primary); }
.wizard-pane { display: none; animation: fadeIn .2s ease; }
.wizard-pane.visible { display: block; }

/* ── OCR ── */
.drop-zone {
  border: 2.5px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: all .2s; background: #fafbff;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.drop-zone-icon { font-size: 48px; margin-bottom: 12px; }
.drop-zone p { color: var(--text-muted); font-size: 14px; }
.ocr-result { margin-top: 24px; }
.ocr-preview { border-radius: var(--radius); overflow: hidden; max-height: 300px; object-fit: contain; width: 100%; border: 1px solid var(--border); }

/* ── DASHBOARD CLASSES ── */
.classe-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.classe-stat-card {
  border-radius: 10px; padding: 16px; text-align: center;
  color: #fff; box-shadow: var(--shadow);
}
.classe-stat-card .icon { font-size: 32px; margin-bottom: 6px; }
.classe-stat-card .nom { font-size: 13px; font-weight: 700; opacity: .9; }
.classe-stat-card .total { font-size: 26px; font-weight: 800; }

/* ── ANIVERSARIS ── */
.birthday-list { list-style: none; }
.birthday-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.birthday-list li:last-child { border-bottom: none; }
.birthday-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.birthday-info { flex: 1; }
.birthday-name { font-weight: 600; font-size: 13.5px; }
.birthday-date { font-size: 12px; color: var(--text-muted); }
.birthday-days { font-size: 12px; font-weight: 700; color: var(--primary); margin-left: auto; white-space: nowrap; }

/* ── USERS TABLE ── */
.user-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-active { background: var(--success); }
.dot-inactive { background: var(--danger); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 52px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 15px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,10,50,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  animation: slideUp .2s ease;
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); transition: color .15s; border-radius: 6px; padding: 2px 6px; }
.modal-close:hover { color: var(--text); background: #f1f5f9; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease; display: flex; align-items: center; gap: 10px; min-width: 240px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ── REPORTS ── */
.campos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.campo-check { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f8fafc; border-radius: 8px; border: 1.5px solid var(--border); cursor: pointer; transition: all .15s; }
.campo-check:hover { border-color: var(--primary); background: var(--primary-light); }
.campo-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.campo-check label { font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text); text-transform: none; letter-spacing: 0; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  padding: 20px;
}
.login-card {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 48px 40px; width: 100%; max-width: 420px; text-align: center;
}
.login-logo { font-size: 64px; margin-bottom: 8px; }
.login-school { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }
.login-form { text-align: left; }
.login-form .form-group { margin-bottom: 16px; }
.login-error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: none; }

/* ── PROGRESS BAR ── */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width .3s ease; }

/* ── ANIMATIONS ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.fade-in { animation: fadeIn .25s ease; }

/* ── HAMBURGER (always defined, hidden on desktop) ── */
.hamburger-btn {
  display: none;
  align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: 8px; color: var(--text);
  font-size: 22px; line-height: 1;
}

/* ── SIDEBAR OVERLAY (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}
.sidebar-overlay.open { display: block; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; grid-template-rows: 60px 1fr; }

  /* Sidebar: oculta per defecte, apareix com overlay */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 260px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(0,0,0,0.25);
  }

  .hamburger-btn { display: flex; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar-title { font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { gap: 6px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
  .grid-2 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-10 { gap: 10px; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabs fitxa infant ── */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  margin-bottom: -2px;
  transition: color 0.15s;
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-btn:hover:not(.active) {
  color: var(--text);
}

/* ── Secció bancària ── */
.section-banc { background: #f0fdf9; border: 1px solid #a7f3d0; color: #065f46; }

/* ── Botons icona festiu ── */
.festiu-icon-btn { transition: border-color .15s, background .15s; }
.festiu-icon-btn:hover { background: #e0e7ff !important; }
.festiu-icon-btn.selected { border-color: var(--primary) !important; background: #e0e7ff !important; box-shadow: 0 0 0 2px rgba(99,102,241,.3); }

/* ── Badge estat educadora ── */
.badge-alta-edu { background:#d1fae5;color:#065f46;font-size:11px;font-weight:600;padding:2px 8px;border-radius:20px;display:inline-block; }
.badge-baixa-edu { background:#f1f5f9;color:#64748b;font-size:11px;font-weight:600;padding:2px 8px;border-radius:20px;display:inline-block; }

/* ══════════════════════════════════════════
   ASSISTÈNCIA DIÀRIA
══════════════════════════════════════════ */

/* ── Tabs de classe per educadores amb múltiples classes ── */
#asist-edu-classes {
    display: none;
    flex-shrink: 0;
    background: white;
    border-bottom: 2px solid var(--border);
    gap: 0;
}
.edu-class-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-bottom: 3px solid transparent;
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.edu-class-tab:hover { background: var(--bg); color: var(--text); }
.edu-class-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #f5f3ff;
}
@media (max-width: 640px) {
    .edu-class-tab { font-size: 13px; padding: 10px 6px; }
}

/* ── Capçalera ── */
.asist-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.asist-date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 220px;
}
.asist-nav-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    flex-shrink: 0;
}
.asist-nav-btn:hover { background: var(--primary-light); }

/* ── Capçalera columnes ── */
.asist-cols-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    flex-shrink: 0;
}
.asist-checks-header {
    display: flex;
    gap: 6px;
    width: 178px;
    flex-shrink: 0;
}
.asist-checks-header span {
    width: 40px;
    text-align: center;
}

/* ── Files infants ── */
.asist-row-wrap {
    border-bottom: 1px solid var(--border);
    background: white;
    transition: background .35s;
}
.asist-row-wrap.saved { background: #f0fdf4; }
.asist-row-wrap:hover { background: #fafafa; }
.asist-row-wrap.asist-absent .asist-nom { text-decoration: line-through; color: #9ca3af; }
.asist-row-wrap.asist-absent { background: #fff1f2; }

.asist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
}

.asist-nom {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.asist-cognom { color: var(--text-muted); font-weight: 400; }

/* ── Selector horari ── */
.asist-horari {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 160px;
    flex-shrink: 0;
}
.asist-hora-sel {
    padding: 4px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--bg);
    color: var(--text);
    width: 68px;
    flex-shrink: 0;
}
.asist-arrow { color: var(--text-muted); font-size: 11px; }

/* ── Botons E/D/B ── */
.asist-checks { display: flex; gap: 6px; flex-shrink: 0; }
.asist-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: white;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    color: #94a3b8;
    transition: all .12s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.asist-btn:hover  { border-color: #a5b4fc; color: var(--primary); }
.asist-btn.active { background: #22c55e; border-color: #16a34a; color: white; }
.asist-btn:active { transform: scale(.88); }

/* ── Loading ── */
.asist-loading {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.8;
}

/* ── Historial (pestanya fitxa infant) ── */
.asist-hist-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border-radius: 10px;
    overflow: hidden;
}
.asist-hist-tbl th {
    padding: 9px 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.hist-th-dia    { background: #f1f5f9; color: var(--text-muted); text-align: left; border-bottom: 2px solid #e2e8f0; }
.hist-th-horari { background: #f1f5f9; color: var(--text-muted); text-align: center; border-bottom: 2px solid #e2e8f0; }
.hist-th-e      { background: #fef9c3; color: #92400e; border-bottom: 2px solid #fde68a; }
.hist-th-d      { background: #dbeafe; color: #1e40af; border-bottom: 2px solid #bfdbfe; }
.hist-th-b      { background: #dcfce7; color: #166534; border-bottom: 2px solid #bbf7d0; }
.asist-hist-tbl td {
    padding: 5px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
    vertical-align: middle;
}
.hist-td-dia    { text-align: left; }
.hist-td-check  { text-align: center; }
.hist-weekend td { background: #f8fafc; color: #94a3b8; }
.hist-dayname { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 3px; }
.hist-daynum  { font-weight: 600; font-size: 13px; }
.hist-horari  { font-size: 12px; text-align: center; white-space: nowrap; }
.hist-hora    { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text); }
.hist-arrow-small { color: var(--text-muted); margin: 0 2px; font-size: 11px; }
.hist-empty   { color: #cbd5e1; }

/* Badges de check per servei */
.hist-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}
.hist-badge-e { background: #fef08a; color: #92400e; }
.hist-badge-d { background: #bfdbfe; color: #1e40af; }
.hist-badge-b { background: #bbf7d0; color: #166534; }
.hist-dot   { color: #d1d5db; font-size: 18px; line-height: 1; }

/* Resum mensual */
.hist-resum {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.hist-resum-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border-radius: 10px;
    text-align: center;
}
.hist-resum-num {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}
.hist-resum-label {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.hist-resum-dies { background: #f1f5f9; color: #475569; }
.hist-resum-e    { background: #fef9c3; color: #92400e; }
.hist-resum-d    { background: #dbeafe; color: #1e40af; }
.hist-resum-b    { background: #dcfce7; color: #166534; }

/* ── Absent & Notes ── */
.asist-btn-absent { background: #fff0f0 !important; color: #dc2626 !important; border-color: #fca5a5 !important; }
.asist-btn-absent.active { background: #ef4444 !important; color: #fff !important; }
.asist-btn-disabled { opacity: 0.3; cursor: not-allowed; }
.asist-nota-wrap {
    width: 46px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.asist-nota-toggle {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    color: #94a3b8;
    transition: all .15s;
    width: 46px;
    flex-shrink: 0;
    text-align: center;
}
.asist-nota-toggle:hover { background: #f1f5f9; border-color: #e2e8f0; }
.asist-nota-toggle.has-nota { color: #6366f1; border-color: #c7d2fe; background: #eef2ff; }
.asist-nota-body { padding: 0 16px 10px; }
.asist-nota-ta {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.asist-client-num { font-size: 11px; color: #94a3b8; margin-left: 6px; }
.hist-th-nota { width: 36px; text-align: center; }
.hist-td-nota { text-align: center; }
.hist-nota-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 2px 5px;
    cursor: pointer;
    font-size: 14px;
    color: #94a3b8;
    transition: all .15s;
}
.hist-nota-btn.active { color: #6366f1; }
.hist-nota-btn.open  { background: #eef2ff; border-color: #c7d2fe; color: #6366f1; }
.hist-nota-btn:hover { background: #f1f5f9; border-color: #e2e8f0; }
.hist-nota-row { background: #f8fafc; }
.hist-nota-cell { padding: 4px 12px 10px !important; border-top: none !important; }
.hist-nota-text {
    font-size: 12px;
    color: #374151;
    background: white;
    border-left: 3px solid #6366f1;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: pre-line;
    line-height: 1.5;
}

/* ── Mòbil: layout de targeta (nom a dalt, controls a baix) ── */
@media (max-width: 640px) {

    /* Capçalera: amaguem INFANT i HORARI, només queden les lletres E D B 🚫 📝 */
    .asist-cols-header .asist-nom-header,
    .asist-cols-header .asist-horari-header { display: none; }
    .asist-cols-header {
        padding: 6px 12px;
        justify-content: flex-end;
        gap: 4px;
    }
    .asist-checks-header { width: auto; gap: 4px; }
    .asist-checks-header span { width: 38px; font-size: 10px; }

    /* Cada fila es converteix en targeta de 2 línies */
    .asist-row-wrap {
        margin: 0;
        border-bottom: 2px solid #f1f5f9;
    }

    .asist-row {
        flex-wrap: wrap;
        padding: 8px 12px 6px;
        gap: 6px;
        row-gap: 6px;
    }

    /* Línia 1: nom ocupa tota l'amplada */
    .asist-nom {
        width: 100%;
        flex: none;
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding-bottom: 2px;
        border-bottom: 1px solid #f1f5f9;
        margin-bottom: 2px;
    }
    /* En mòbil SÍ mostrem el cognom (nom complet és important) */
    .asist-cognom { display: inline !important; font-weight: 400; color: var(--text-muted); }

    /* Línia 2: horari + botons junts, sense nom */
    .asist-horari {
        width: auto;
        flex: 1;
        min-width: 0;
    }
    .asist-hora-sel {
        width: 60px;
        font-size: 12px;
        padding: 5px 2px;
        height: 36px;
    }

    .asist-checks { gap: 4px; }
    .asist-btn { width: 38px; height: 38px; font-size: 14px; border-radius: 10px; }

    .asist-nota-wrap { width: 38px; }
    .asist-nota-toggle { width: 38px; height: 38px; font-size: 14px; }

    /* Nota expandida: padding ajustat */
    .asist-nota-body { padding: 0 12px 8px; }
    .asist-nota-body textarea { font-size: 13px; }

    /* Número de client: petit i discret */
    .asist-client-num { font-size: 10px; }
}
