/* Broadsheet — tokens repris du design system, + classes propres au calendrier. */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #0088b0;
  --color-accent-2: #d6006c;
  --color-divider: color-mix(in srgb, #201e1d 16%, transparent);

  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-600: #7d7979;
  --color-neutral-800: #444141;

  --color-accent-100: #e9f8ff;
  --color-accent-200: #cbeeff;
  --color-accent-600: #1186ac;
  --color-accent-700: #006786;
  --color-accent-800: #004961;

  --color-accent-2-100: #fff1f4;
  --color-accent-2-200: #ffdee6;
  --color-accent-2-700: #aa0b56;
  --color-accent-2-800: #790e3d;

  --font-heading: "Source Serif 4", system-ui, sans-serif;
  --font-heading-weight: 600;
  --font-body: "Source Serif 4", system-ui, sans-serif;

  --space-1: 5px;
  --space-2: 10px;
  --space-3: 15px;
  --space-4: 20px;
  --space-6: 30px;

  --radius-sm: 1px;
  --radius-md: 2px;
  --radius-lg: 4px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font-family: var(--font-body); font-size: 15px; line-height: 1.55; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2); }
h1 { font-size: 32px; }
h3 { font-size: 20px; }
h5 { font-size: 15px; }
p { margin: 0 0 var(--space-3); }
img { display: block; max-width: 100%; }
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — forms — */
.field > label { display: block; font-size: 12px; margin-bottom: 5px; color: color-mix(in srgb, var(--color-text) 70%, transparent); }
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit; font-size: 14px;
  color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input::placeholder { color: color-mix(in srgb, var(--color-text) 65%, transparent); opacity: 1; }
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.radio .dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1.5px solid var(--color-divider); }
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot { border-color: var(--color-accent); background: var(--color-accent); box-shadow: inset 0 0 0 4px var(--color-bg); }
.radio input:focus-visible + .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.seg { display: inline-flex; overflow: hidden; border: 1px solid var(--color-divider); border-radius: var(--radius-md); }
.seg-opt { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { background: var(--color-accent); color: var(--color-bg); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* — cards — */
.card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface); }

/* — tags — */
.tag { display: inline-flex; align-items: center; font-size: 11px; letter-spacing: 0.02em; padding: 3px 10px; border-radius: calc(var(--radius-md) * 0.75); }

/* — navigation — */
.nav { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); }
.nav-brand { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 18px; margin-right: auto; }

/* — dialog — */
.dialog-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--space-4); background: color-mix(in srgb, #2d2b2b 50%, transparent); z-index: 100; }
.dialog { width: min(440px, 100%); max-height: calc(100vh - var(--space-8, 40px)); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-lg); }
.dialog-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* ══════════════════════════════════════════════════════════════
   Calendrier — mise en page propre à l'app
   ══════════════════════════════════════════════════════════════ */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--color-bg); }

.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.login-form { width: min(360px, 100%); display: flex; flex-direction: column; gap: var(--space-3); }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-divider); }
.toolbar-nav { display: flex; align-items: center; gap: var(--space-1); }
.toolbar-header { margin: 0 var(--space-2) 0 0; white-space: nowrap; }
.toolbar-people { display: flex; gap: 6px; margin-left: var(--space-2); }
.people-tag { cursor: pointer; border: none; font: inherit; }
.people-tag.is-inactive { background: var(--color-neutral-100); color: var(--color-neutral-600); }

.view-area { flex: 1; overflow: auto; padding: var(--space-4); }

/* month view */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--color-divider); border: 1px solid var(--color-divider); border-radius: var(--radius-md); overflow: hidden; }
.month-weekday { background: var(--color-surface); padding: 6px 8px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.month-cell { min-height: 96px; padding: 4px; background: var(--color-bg); display: flex; flex-direction: column; cursor: pointer; }
.month-cell.drag-over { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.month-daynum { font-size: 12px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.month-daynum.is-today { background: var(--color-accent); color: var(--color-bg); }
.month-pill { font-size: 11px; padding: 2px 6px; border-radius: 3px; margin-top: 2px; cursor: grab; touch-action: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-pill.is-dragging { opacity: 0.4; cursor: grabbing; }
.month-extra { font-size: 10.5px; color: color-mix(in srgb, var(--color-text) 55%, transparent); padding: 1px 4px; }

/* week / day views */
.time-grid { display: grid; border: 1px solid var(--color-divider); border-radius: var(--radius-md); overflow: hidden; }
.time-grid-week { grid-template-columns: 56px repeat(7, 1fr); }
.time-grid-day { grid-template-columns: 56px 1fr 1fr; }
.time-col-head { background: var(--color-surface); padding: 8px; text-align: center; border-left: 1px solid var(--color-divider); }
.time-col-head.no-border { border-left: none; }
.time-col-weekday { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.time-col-daynum { font-size: 16px; margin-top: 2px; width: 26px; height: 26px; line-height: 26px; border-radius: 50%; margin-inline: auto; }
.time-col-daynum.is-today { background: var(--color-accent); color: var(--color-bg); }
.time-col-title { padding: 10px; text-align: center; border-left: 1px solid var(--color-divider); font-weight: 600; }
.time-labels { position: relative; background: var(--color-bg); }
.time-label { position: absolute; left: 0; right: 6px; text-align: right; font-size: 10.5px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.time-col { position: relative; height: 900px; border-left: 1px solid var(--color-divider); background: var(--color-bg); }
.time-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--color-divider); }
.time-event { position: absolute; left: 4px; right: 4px; padding: 3px 6px; border-radius: 3px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); }
.time-event-title { font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-event-meta { font-size: 10.5px; opacity: 0.85; }
.allday-cell { background: var(--color-surface); border-left: 1px solid var(--color-divider); padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.time-day-overlay { grid-column: 2 / -1; grid-row: 3; position: relative; height: 900px; pointer-events: none; }
.time-day-overlay .time-event { pointer-events: auto; }
.allday-pill { font-size: 11px; padding: 2px 6px; border-radius: 3px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* agenda view */
.agenda-list { display: flex; flex-direction: column; gap: var(--space-4); max-width: 640px; }
.agenda-group-label { margin: 0 0 var(--space-2); color: color-mix(in srgb, var(--color-text) 65%, transparent); }
.agenda-group-events { display: flex; flex-direction: column; gap: var(--space-2); }
.agenda-item { flex-direction: row; align-items: center; gap: var(--space-3); cursor: pointer; }
.agenda-item-body { flex: 1; min-width: 0; }
.agenda-item-title { font-weight: 600; font-size: 14px; }
.agenda-item-meta { font-size: 12.5px; }

/* event modal */
.photo-thumb { position: relative; width: 84px; height: 84px; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.photo-remove { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; background: var(--color-text); color: var(--color-bg); border-radius: 50%; font-size: 12px; padding: 0; }
.photo-add { width: 84px; height: 84px; flex-direction: column; font-size: 12px; }

@media (max-width: 640px) {
  .time-grid-day { grid-template-columns: 40px 1fr 1fr; }
  .time-grid-week { grid-template-columns: 40px repeat(7, minmax(60px, 1fr)); overflow-x: auto; }
}
