/* ─── Page layout (cartes claires hors agenda) ─────────────────────────── */
.ios-calendar-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ios-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ios-calendar-head h1 {
  margin: 0;
  font-size: 1.4rem;
}

.ios-agenda-intro {
  margin: 0;
  font-size: 0.9rem;
  color: var(--pf-text-muted, #64748b);
  line-height: 1.45;
}

.ios-cal-prefs-details {
  margin-top: 14px;
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--pf-bg-page, #fff);
}

.ios-cal-prefs-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.ios-cal-prefs-help {
  margin: 10px 0 12px;
  font-size: 0.85rem;
  color: var(--pf-text-muted, #64748b);
  line-height: 1.45;
}

.ios-cal-prefs-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.ios-cal-pref-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px 12px;
  padding: 8px 10px;
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: 8px;
  background: var(--pf-bg-lighter, #f8fafc);
}

.ios-cal-pref-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.ios-cal-pref-label {
  font-size: 0.88rem;
  min-width: 0;
  word-break: break-word;
}

.ios-cal-pref-color {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  background: var(--pf-bg-page, #fff);
}

.ios-cal-pref-reset {
  border: none;
  background: transparent;
  color: var(--pf-text-muted, #64748b);
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
  font-family: inherit;
  white-space: nowrap;
}

.ios-cal-pref-reset:hover {
  color: var(--pf-text-main, #0f172a);
}

.ios-cal-prefs-msg {
  min-height: 1.25em;
  font-size: 0.85rem;
  margin: 0 0 10px;
}

@media (max-width: 640px) {
  .ios-cal-pref-row {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }
  .ios-cal-pref-color {
    grid-column: 2;
  }
  .ios-cal-pref-reset {
    grid-column: 2;
    justify-self: start;
  }
}

.ios-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ios-form-full {
  grid-column: 1 / -1;
}

.ios-form-actions {
  display: flex;
  gap: 8px;
}

.ios-events-list {
  display: grid;
  gap: 10px;
}

.ios-event-card {
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: 10px;
  padding: 12px;
  background: var(--pf-bg-page, #fff);
}

.ios-event-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.ios-event-card-title {
  font-weight: 700;
}

.ios-event-card-meta {
  color: var(--pf-text-muted, #64748b);
  font-size: 0.9rem;
}

.ios-event-card-actions {
  display: flex;
  gap: 8px;
}

/* ─── Agenda sombre (style type app calendrier) ─────────────────────────── */
.ios-agenda-card {
  --ios-bg: #0a0a0c;
  --ios-elev: #12121a;
  --ios-border: rgba(255, 255, 255, 0.08);
  --ios-text: #f1f5f9;
  --ios-muted: #94a3b8;
  --ios-now: #ef4444;
  --ios-seg-bg: #1a1a22;
  background: var(--ios-bg);
  border: 1px solid var(--ios-border);
  color: var(--ios-text);
  border-radius: 12px;
  overflow: hidden;
}

.ios-agenda-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ios-border);
  background: var(--ios-elev);
}

.ios-agenda-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: capitalize;
  min-width: 140px;
}

.ios-agenda-segments {
  display: inline-flex;
  background: var(--ios-seg-bg);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.ios-seg {
  border: none;
  background: transparent;
  color: var(--ios-muted);
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.ios-seg:hover {
  color: var(--ios-text);
}

.ios-seg--active {
  background: #2d2d38;
  color: var(--ios-text);
  font-weight: 600;
}

.ios-agenda-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ios-agenda-btn {
  border: 1px solid var(--ios-border);
  background: var(--ios-elev);
  color: var(--ios-text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.ios-agenda-btn:hover {
  background: #1e1e28;
}

.ios-agenda-btn--ghost {
  background: transparent;
}

.ios-agenda-today {
  border: none;
  background: transparent;
  color: var(--ios-now);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 10px;
  font-family: inherit;
}

.ios-agenda-add {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--ios-border);
  background: var(--ios-elev);
  color: var(--ios-text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.ios-agenda-add:hover {
  background: #1e1e28;
}

.ios-agenda-listlink {
  border: none;
  background: transparent;
  color: var(--ios-muted);
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 8px;
  font-family: inherit;
}

.ios-agenda-listlink:hover {
  color: var(--ios-text);
}

.ios-agenda-mount {
  min-height: 200px;
}

.ios-agenda-list-hint {
  margin: 0;
  padding: 20px 16px;
  color: var(--ios-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Grille semaine / jour */
.ios-week-wrap {
  display: flex;
  flex-direction: column;
}

.ios-week-head {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--ios-border);
  background: var(--ios-elev);
  font-size: 0.78rem;
  color: var(--ios-muted);
}

.ios-week-head--day {
  grid-template-columns: 52px minmax(0, 1fr);
}

.ios-week-corner {
  border-right: 1px solid var(--ios-border);
}

.ios-week-head-day {
  text-align: center;
  padding: 10px 4px;
  border-left: 1px solid var(--ios-border);
}

.ios-week-head-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  color: var(--ios-text);
  margin-right: 4px;
}

.ios-week-head-day--today .ios-week-head-num {
  background: var(--ios-now);
  color: #fff;
}

.ios-week-scroll {
  max-height: min(70vh, 720px);
  overflow-y: auto;
  overflow-x: auto;
}

.ios-week-track {
  display: flex;
  min-width: min(100%, 720px);
  align-items: stretch;
}

.ios-agenda-gutter {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--ios-border);
  background: var(--ios-bg);
}

.ios-agenda-gutter-cell {
  height: 44px;
  font-size: 0.72rem;
  color: var(--ios-muted);
  text-align: right;
  padding-right: 8px;
  line-height: 44px;
  box-sizing: border-box;
}

.ios-agenda-cols-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  display: flex;
  min-height: 704px;
}

.ios-agenda-cols {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
  min-height: 704px;
}

.ios-agenda-cols--day {
  grid-template-columns: minmax(0, 1fr);
}

.ios-agenda-col {
  border-left: 1px solid var(--ios-border);
  background-color: var(--ios-bg);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 43px,
    var(--ios-border) 43px,
    var(--ios-border) 44px
  );
}

.ios-agenda-col:first-child {
  border-left: none;
}

.ios-agenda-col-inner {
  position: relative;
}

.ios-event-block {
  position: absolute;
  border: none;
  border-radius: 6px;
  padding: 4px 6px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.25;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.35);
}

.ios-event-block--custom {
  border: none !important;
  color: #fff !important;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.35) !important;
}

.ios-event-block-title {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ios-cal-c0 {
  background: linear-gradient(135deg, #166534, #15803d);
}
.ios-cal-c1 {
  background: linear-gradient(135deg, #1e40af, #2563eb);
}
.ios-cal-c2 {
  background: linear-gradient(135deg, #6b21a8, #7c3aed);
}
.ios-cal-c3 {
  background: linear-gradient(135deg, #a16207, #ca8a04);
}
.ios-cal-c4 {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}
.ios-cal-c5 {
  background: linear-gradient(135deg, #9f1239, #e11d48);
}

.ios-now-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.ios-now-line-span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ios-now);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.ios-now-lbl-span {
  position: absolute;
  left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ios-now);
  text-shadow: 0 0 6px #000;
}

/* Mois (dans carte sombre) */
.ios-month-agenda {
  padding: 12px 14px 16px;
}

.ios-month-agenda-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  font-size: 0.72rem;
  color: var(--ios-muted);
  text-align: center;
}

.ios-month-agenda-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.ios-month-cell {
  aspect-ratio: 1;
  min-height: 40px;
  border: 1px solid var(--ios-border);
  border-radius: 8px;
  background: var(--ios-elev);
  color: var(--ios-text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 2px;
  font: inherit;
}

.ios-month-cell--pad {
  visibility: hidden;
  pointer-events: none;
  border: none;
  background: transparent;
}

.ios-month-cell--today {
  border-color: var(--ios-now);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}

.ios-month-cell--has {
  background: #1a1a24;
}

.ios-month-num {
  font-size: 0.85rem;
  font-weight: 600;
}

.ios-month-dots {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}

.ios-month-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #60a5fa;
}

@media (max-width: 768px) {
  .ios-form-grid {
    grid-template-columns: 1fr;
  }
  .ios-calendar-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .ios-event-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .ios-agenda-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .ios-agenda-segments {
    justify-content: center;
  }
  .ios-agenda-nav {
    justify-content: center;
  }
}
