/* Style « Ruban » — fond gris foncé */

/* DM Sans (licence OFL, voir fonts/OFL.txt), servie par le site lui-même */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url(fonts/dm-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url(fonts/dm-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
  --bg: #2B2B2B;
  --deep: #1F1F1F;
  --raised: #3A3A3A;
  --text: #F4F3EE;
  --soft: #DADADA;
  --muted: #C2C2C2;
  --seg: #474747;
  --line: #5C5C5C;
  --jour: #2ECC71;
  --soir: #FFD23F;
  --nuit: #FF7A3D;
  --error: #FF9B8A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.caps { font-size: 16px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.3; }
.caps.small { font-size: 12px; color: var(--muted); }
.strong { font-size: 15px; font-weight: 600; }
.bold { font-weight: 700; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 12px; }
.error { color: var(--error); font-size: 14px; }
.info { color: var(--jour); font-size: 14px; }
.notice { color: var(--error); font-size: 14px; font-weight: 600; line-height: 1.4; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  z-index: 10;
  background: var(--text);
  color: var(--bg);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Structure ---------- */
.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.block { display: flex; flex-direction: column; gap: 10px; }
.block.tight { gap: 8px; }

/* ---------- Ruban ---------- */
.ribbon { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg { background: var(--seg); }
.seg.on.j { background: var(--jour); }
.seg.on.s { background: var(--soir); }
.seg.on.n { background: var(--nuit); }
.logo { width: 44px; height: 47px; flex-shrink: 0; }
.ribbon-big { gap: 3px; height: 18px; }
.ribbon-thin { gap: 3px; height: 10px; }
.ribbon-day { gap: 1px; height: 16px; }
.ribbon-mini { display: flex; gap: 2px; height: 12px; }
.ribbon-mini .seg { width: 18px; }
.ribbon-mini .seg.extra { margin-left: 3px; }

/* ---------- Boutons et champs ---------- */
.btn {
  appearance: none;
  height: 54px;
  flex-shrink: 0;
  border-radius: 27px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  padding: 0 20px;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--text); color: var(--bg); }
.btn.outline { border-color: var(--text); }
.btn.text { height: 48px; color: var(--muted); font-size: 15px; font-weight: 600; }

.link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 44px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link.small { font-size: 13px; font-weight: 600; }
.link.danger { color: var(--error); }
.btn.danger-fill { background: var(--error); color: var(--bg); }
.legal { text-align: center; line-height: 1.4; }
.legal a { color: var(--text); font-weight: 700; }
.legal-page { padding: 24px 20px 48px; gap: 22px; line-height: 1.55; }
.legal-page h1 { font-size: 26px; line-height: 1.2; }
.legal-page section { display: flex; flex-direction: column; gap: 8px; }
.legal-page ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.legal-page .link { align-self: flex-start; }
.profile-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.profile-links > * { display: flex; align-items: center; min-height: 44px; }

.round {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

form { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input:not([type]) {
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--deep);
  padding: 0 14px;
  font-size: 16px; /* évite le zoom automatique sur iOS */
  font-weight: 400;
}

/* ---------- Connexion / inscription ---------- */
.auth { padding: 56px 24px 32px; gap: 32px; }
.brand { display: flex; align-items: center; gap: 12px; }
.auth-panel { flex: 1; display: flex; flex-direction: column; gap: 32px; }
.auth-head { display: flex; flex-direction: column; gap: 8px; }
.auth-head h1 { font-size: 30px; font-weight: 700; line-height: 1.1; }
.auth form .link { align-self: flex-start; }
.auth form .btn { margin-top: 8px; }
.auth-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.auth-foot.row { flex-direction: row; align-items: center; justify-content: center; gap: 6px; }

/* ---------- Application ---------- */
.app { padding: 16px 16px 0; }
.tab { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-bottom: 18px; }

/* Horaire */
.next-bar { display: flex; flex-direction: column; gap: 6px; }
.ribbon-labels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; font-size: 12px; color: var(--muted); }

.month { gap: 12px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-buttons { display: flex; align-items: center; gap: 8px; }
.weekdays, .calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.calendar { row-gap: 8px; }

.day {
  appearance: none;
  height: 52px;
  border: 0;
  background: transparent;
  padding: 0 1px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
}
.day.blank { cursor: default; }
.day .num {
  align-self: center;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.day.today .num { background: var(--text); color: var(--bg); font-weight: 700; }

.ad-slot {
  /* Prend la place qui reste sous l'horaire : 180 px au plus, 100 px au moins. */
  align-self: center;
  flex: 1 1 100px;
  min-height: 100px;
  max-height: 180px;
  width: 100%;
  max-width: 340px;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Cartes et listes */
.card { border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
#tab-rappels { gap: 14px; }
.row-card { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list { display: flex; flex-direction: column; }
.list > label {
  height: 48px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--seg);
}
.list > :last-child { border-bottom: 0; }
.list input[type="radio"] { width: 22px; height: 22px; margin: 0; accent-color: var(--text); }

.switch {
  appearance: none;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border: 0;
  border-radius: 16px;
  background: var(--seg);
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.switch span { width: 26px; height: 26px; border-radius: 13px; background: var(--muted); }
.switch[aria-checked="true"] { background: var(--text); justify-content: flex-end; }
.switch[aria-checked="true"] span { background: var(--bg); }
.switch:disabled { opacity: 0.45; cursor: default; }

.preview { background: var(--deep); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }

/* Profil */
.profile-head { display: flex; align-items: center; gap: 16px; }
.avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 32px;
  background: var(--text);
  color: var(--bg);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-name { font-size: 22px; font-weight: 700; line-height: 1.15; }
.profile-id span, .row-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-btn {
  appearance: none;
  height: 60px;
  border: 0;
  border-bottom: 1px solid var(--seg);
  background: transparent;
  padding: 0;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.row-btn svg { flex-shrink: 0; color: var(--muted); }
.row-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* Barre du bas */
.tabbar {
  position: sticky;
  bottom: 0;
  margin: 0 -16px;
  background: var(--deep);
  border-top: 1px solid var(--line);
  padding: 4px 16px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tabbar button {
  appearance: none;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.tabbar button[aria-current="page"] { color: var(--text); font-weight: 700; }

/* ---------- Panneaux du bas ---------- */
.sheet {
  border: 0;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
}
.sheet[open] { display: flex; flex-direction: column; gap: 18px; }
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.grabber { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.4; }
.steps svg { vertical-align: -3px; }
.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.option {
  appearance: none;
  height: 100px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  padding: 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.option[aria-pressed="true"] { border: 2px solid var(--text); background: var(--raised); }
.option[aria-pressed="true"] .seg:not(.on) { background: var(--line); }

@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 24px; }
}
