/* ── Apple-style Design Tokens ── */
:root {
  --primary:       #1a9e5c;
  --primary-hover: #17b865;
  --primary-soft:  #e6f7ef;

  --success:       #1d9d57;
  --success-bg:    #f0faf4;
  --success-border:#c3e6d2;

  --warn:          #c47a00;
  --warn-bg:       #fff8eb;
  --warn-border:   #f5d78e;

  --danger:        #d93025;
  --danger-dark:   #b5261e;
  --danger-bg:     #fff2f1;
  --danger-border: #f5c6c3;

  --whatsapp:      #25d366;
  --whatsapp-dark: #128c4e;

  --text-primary:   #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted:     #98989d;

  --bg-page:  #f5f5f7;
  --bg-card:  #ffffff;
  --border:   rgba(0, 0, 0, 0.08);

  --nav-bg:   rgba(255,255,255,0.82);
  --nav-border: rgba(0,0,0,0.08);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-pill:980px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.13);

  --transition: all 0.31s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.23s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark Mode Tokens ── */
[data-theme="dark"] {
  --primary:       #34d07a;
  --primary-hover: #3ddb84;
  --primary-soft:  rgba(52,208,122,0.12);

  --success:       #34d07a;
  --success-bg:    rgba(52,208,122,0.1);
  --success-border:rgba(52,208,122,0.2);

  --warn:          #f5c842;
  --warn-bg:       rgba(245,200,66,0.1);
  --warn-border:   rgba(245,200,66,0.2);

  --danger:        #ff6b6b;
  --danger-dark:   #ff4f4f;
  --danger-bg:     rgba(255,107,107,0.1);
  --danger-border: rgba(255,107,107,0.2);

  --text-primary:   #f5f5f7;
  --text-secondary: #98989d;
  --text-muted:     #636366;

  --bg-page:  #000000;
  --bg-card:  #1c1c1e;
  --border:   rgba(255,255,255,0.08);

  --nav-bg:   rgba(28,28,30,0.85);
  --nav-border: rgba(255,255,255,0.08);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.38s ease, color 0.38s ease;
}

/* ── Navigation — frosted glass ── */
nav {
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--nav-border);
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-brand:hover { text-decoration: none; color: var(--primary); }

.nav-links {
  display: flex;
  gap: 0.1rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.nav-links a:hover { color: var(--text-primary); background: rgba(128,128,128,0.1); }

.nav-active {
  color: var(--primary) !important;
  font-weight: 600;
}

.nav-user {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Nav Icon Buttons ── */
.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.18s ease, background 0.18s ease;
  overflow: hidden;
  white-space: nowrap;
}

.nav-icon-btn:hover { color: var(--text-primary); background: rgba(128,128,128,0.1); }
.nav-icon-btn:hover { text-decoration: none; }
.nav-icon-btn.nav-active { color: var(--primary); }

.nav-icon-btn svg { flex-shrink: 0; }

.nav-icon-btn .nav-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.23s ease, padding 0.28s ease;
  padding-right: 0;
}

.nav-icon-btn:hover .nav-label {
  max-width: 8rem;
  opacity: 1;
  padding-right: 0.4rem;
}

/* ── iOS-style Toggle ── */
.ios-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}

.ios-toggle-row span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.ios-toggle {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  cursor: pointer;
  flex-shrink: 0;
}

.ios-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.ios-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(120,120,128,0.2);
  border-radius: 31px;
  transition: background 0.28s ease;
}

[data-theme="dark"] .ios-toggle-track { background: rgba(120,120,128,0.32); }

.ios-toggle input:checked + .ios-toggle-track { background: var(--primary); }

.ios-toggle-track::after {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
}

.ios-toggle input:checked + .ios-toggle-track::after { transform: translateX(20px); }

/* ── Layout ── */
main {
  max-width: 820px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fade-in-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .container { animation: none; }
}

/* ── Typography ── */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.875rem;
  letter-spacing: -0.01em;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: background 0.3s ease, box-shadow 0.25s cubic-bezier(0.4,0,0.2,1), border-color 0.3s ease;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-warn     { border-top: 3px solid var(--warn); }
.card-danger   { border-top: 3px solid var(--danger); }
.card-today    { border-top: 3px solid var(--whatsapp); }
.card-tomorrow { border-top: 3px solid var(--warn); }
.card-earnings { border-top: 3px solid var(--success); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
}

.card-header h2 { margin-bottom: 0; }

/* ── Auth ── */
.auth-container {
  max-width: 400px;
  margin: 4rem auto;
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.auth-container h1 { text-align: center; margin-bottom: 0.4rem; }
.auth-container h2 { margin-bottom: 1rem; }

.auth-desc {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.auth-note {
  color: var(--text-secondary);
  font-size: 0.84rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.auth-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Forms ── */
label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  margin-top: 0.3rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition-fast);
  resize: vertical;
}

textarea:hover { border-color: rgba(128,128,128,0.35); }

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  margin-top: 0.3rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition-fast);
}

input:hover  { border-color: rgba(128,128,128,0.35); }

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* ── Buttons ── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  min-height: 40px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  letter-spacing: -0.01em;
  transition: var(--transition-fast);
  white-space: nowrap;
}

button:hover, .btn:hover {
  background: var(--primary-hover);
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(26,158,92,0.35);
}

button:active, .btn:active {
  transform: scale(0.98);
  box-shadow: none;
}

button:disabled {
  background: #c7c7cc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(128,128,128,0.12);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: rgba(128,128,128,0.2);
  box-shadow: none;
}

.btn-danger {
  background: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-dark);
  box-shadow: 0 4px 16px rgba(217,48,37,0.3);
}

.btn-small {
  padding: 0.35rem 1rem;
  min-height: 34px;
  font-size: 0.82rem;
}

/* ── Status ── */
.status          { padding: 0.2rem 0; font-weight: 500; font-size: 0.9rem; }
.status-ok,
.status-success  { color: var(--success); }
.status-warn     { color: var(--warn); }
.status-error    { color: var(--danger); }

/* ── Flash messages ── */
.flash {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: fade-in-up 0.31s ease both;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th, td {
  padding: 0.65rem 0.875rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-page);
}

tbody tr { transition: var(--transition-fast); }
tbody tr:hover { background: rgba(128,128,128,0.04); }
tbody tr:last-child td { border-bottom: none; }

ul { padding-right: 1.25rem; }

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

/* ── Sync progress ── */
.sync-progress {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.1rem;
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
  background: var(--primary-soft);
  border-radius: var(--radius-md);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.88s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Radio group ── */
.radio-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 400;
  font-size: 0.9rem;
  margin-bottom: 0;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  color: var(--text-primary);
}

.radio-label:hover { background: rgba(128,128,128,0.06); }
.radio-label input[type="radio"] { margin: 0; accent-color: var(--primary); }

/* ── Setup wizard ── */
.setup-wizard { border-top: 3px solid var(--primary); }

.setup-steps { display: flex; flex-direction: column; gap: 0.875rem; margin-top: 1rem; }

.setup-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  background: var(--bg-page);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.setup-step.step-active  { background: var(--primary-soft); border-color: rgba(26,158,92,0.2); }
.setup-step.step-done    { background: var(--success-bg); border-color: var(--success-border); }
.setup-step.step-pending { opacity: 0.4; }

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.step-done .step-number    { background: var(--success); }
.step-pending .step-number { background: #c7c7cc; }

.step-content h3  { font-size: 0.925rem; font-weight: 600; margin-bottom: 0.2rem; }
.step-content p   { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.step-status      { color: var(--success) !important; font-weight: 500; font-size: 0.85rem; }

/* ── Students ── */
.students-search-bar { margin-bottom: 1rem; }

.students-search-bar input {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.students-search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.student-name    { font-weight: 500; }
.student-phone   { color: var(--text-secondary); direction: ltr; text-align: right; font-size: 0.875rem; }
.student-actions { text-align: left; white-space: nowrap; }

/* ── Earnings ── */
.earnings-total {
  font-size: 3rem;
  font-weight: 800;
  color: var(--success);
  margin: 0.25rem 0 1.25rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.earnings-breakdown {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.earnings-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  background: var(--success-bg);
  border-bottom: 1px solid var(--success-border);
  transition: var(--transition-fast);
}

.earnings-row:last-child { border-bottom: none; }
.earnings-row:hover { background: rgba(29,157,87,0.07); }

.earnings-label  { font-weight: 500; color: var(--text-primary); }
.earnings-detail { color: var(--text-muted); font-size: 0.78rem; }

.earnings-amount {
  font-weight: 700;
  font-size: 0.925rem;
  color: var(--success);
  min-width: 4.5rem;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.earnings-time {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.earnings-time h3 {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 0.2rem 0;
  color: var(--text-secondary);
}

.earnings-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Today / Tomorrow lessons ── */
.today-lessons { display: flex; flex-direction: column; gap: 0.5rem; }

.today-lesson-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: var(--transition-fast);
}

.today-lesson-item:hover {
  background: var(--primary-soft);
  border-color: rgba(26,158,92,0.25);
  transform: translateX(-2px);
}

.lesson-info   { display: flex; align-items: center; gap: 0.875rem; }

.lesson-time {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  min-width: 3.25rem;
  font-variant-numeric: tabular-nums;
}

.lesson-name { font-size: 0.9rem; font-weight: 500; }

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
  padding: 0.38rem 0.9rem;
  font-size: 0.8rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 500;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  transition: var(--transition-fast);
  letter-spacing: -0.01em;
}

.btn-whatsapp:hover {
  background: var(--whatsapp-dark);
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(37,211,102,0.35);
  text-decoration: none;
}

.no-phone    { color: var(--text-muted); font-size: 0.8rem; }

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.9rem;
}

/* ── Week schedule ── */
.week-schedule { display: flex; flex-direction: column; gap: 1.1rem; }

.week-day { padding-right: 0.875rem; }

.week-day-header {
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.week-event {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.3rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition-fast);
}

.week-event:last-child { border-bottom: none; }
.week-event:hover { color: var(--primary); padding-right: 0.25rem; }

.week-event-time {
  color: var(--text-muted);
  font-size: 0.78rem;
  min-width: 7rem;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.week-event-title { color: var(--text-primary); font-weight: 450; }

/* ── Mobile ── */
@media (max-width: 640px) {
  nav {
    height: auto;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    position: static;
  }

  .nav-links { flex-wrap: wrap; gap: 0.1rem; }
  .nav-user  { display: none; }

  main { margin: 1rem auto; padding: 0 0.875rem; }
  .container { gap: 0.75rem; }
  .card { padding: 1.25rem; border-radius: var(--radius-lg); }

  .card-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  button, .btn { min-height: 44px; padding: 0.65rem 1.4rem; }
  .btn-small   { min-height: 38px; }

  .today-lesson-item { flex-wrap: wrap; gap: 0.5rem; }

  .earnings-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .earnings-detail { grid-column: 1 / -1; }
  .earnings-amount { text-align: right; }
  .earnings-total  { font-size: 2.25rem; }

  .week-event { flex-direction: column; gap: 0.1rem; padding: 0.4rem 0; }
  .week-event-time { min-width: unset; }

  .setup-step { flex-direction: column; }

  .auth-container { margin: 1.5rem auto; padding: 1.5rem; }

  .students-search-bar input { font-size: 16px; }

  .time-row {
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
  }
  .time-row:last-child { border-bottom: none; }
}

/* ── Calendar view ─────────────────────────────── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.cal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  min-width: 9rem;
  text-align: center;
}

.cal-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.3rem;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.cal-nav-btn:hover { background: var(--bg-hover); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-day-name {
  background: var(--bg-card);
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cal-cell {
  background: var(--bg-card);
  min-height: 5.5rem;
  padding: 0.3rem 0.35rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-cell-empty {
  background: var(--bg);
  opacity: 0.5;
}

.cal-today {
  background: color-mix(in srgb, var(--primary) 7%, var(--bg-card));
}

.cal-day-num {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
  line-height: 1;
}

.cal-today-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.cal-event {
  font-size: 0.65rem;
  border-radius: 4px;
  padding: 2px 4px;
  line-height: 1.3;
  overflow: hidden;
  position: relative;
}

.cal-event-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cal-event-private {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
}

.cal-event-class {
  background: color-mix(in srgb, #f59e0b 18%, transparent);
  color: #b45309;
}

[data-theme="dark"] .cal-event-class {
  color: #fbbf24;
}

.cal-event-time {
  font-weight: 700;
  font-size: 0.6rem;
  opacity: 0.85;
}

.cal-event-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* WhatsApp slide-up reveal */
.cal-event-wa {
  cursor: default;
}

.cal-wa-slide {
  position: absolute;
  bottom: -100%;
  left: 0;
  right: 0;
  height: 1.5rem;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  transition: bottom 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cal-event-wa.wa-open .cal-wa-slide {
  bottom: 0;
}

.cal-wa-slide:hover {
  background: #1ebe5b;
}

@media (max-width: 600px) {
  .cal-grid { gap: 1px; }
  .cal-cell { min-height: 3.5rem; padding: 0.2rem; }
  .cal-day-name { font-size: 0.6rem; padding: 0.3rem 0; }
  .cal-event { font-size: 0.55rem; padding: 1px 3px; }
  .cal-event-time { display: none; }
  .cal-title { font-size: 1.05rem; }
}

/* ── Moed pill selector ─────────────────────────── */
.moed-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.moed-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.moed-pill:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.moed-pill-active {
  background: color-mix(in srgb, var(--primary) 12%, var(--bg-card));
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
