:root {
  --bg: #101418; --panel: #171d24; --panel2: #1e2630; --text: #eef2f6;
  --dim: #9fb0c0; --accent: #e8b34b; --line: #2a3542;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(16,20,24,.92);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.brand { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.brand-mark, .login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #14100a; font-weight: 800;
}
.logout {
  background: none; border: 1px solid var(--line); color: var(--dim);
  border-radius: 999px; padding: 6px 14px; font-size: 14px; cursor: pointer;
}
main { max-width: 880px; margin: 0 auto; padding: 18px 16px 8px; }
h2 { font-size: 22px; margin: 4px 0 14px; }
.view { display: none; }
.view.active { display: block; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 15px 16px; margin-bottom: 12px;
}
.card p { margin: 6px 0 0; line-height: 1.45; }
.card.ok { border-color: var(--accent); background: var(--panel2); }
.dim { color: var(--dim); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: rgba(18,23,29,.97);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; background: none; border: 0; color: var(--dim); cursor: pointer;
  font-size: 11.5px; padding: 8px 2px 10px; display: flex;
  flex-direction: column; align-items: center; gap: 3px; min-height: 56px;
}
.tab-ico { font-size: 20px; line-height: 1; }
.tab.active { color: var(--accent); }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar {
    top: 57px; bottom: auto; justify-content: center; gap: 8px;
    padding: 8px 0; position: sticky;
  }
  .tab { flex: 0 0 auto; flex-direction: row; gap: 7px; font-size: 14.5px;
         padding: 8px 18px; min-height: 0; border-radius: 999px; }
  .tab.active { background: var(--panel2); }
  .tab-ico { font-size: 16px; }
}
/* Connexion */
.login-body { display: flex; min-height: 100dvh; align-items: center; justify-content: center; padding-bottom: 0; }
.login-card { text-align: center; padding: 28px 22px; max-width: 340px; }
.login-logo { width: 64px; height: 64px; border-radius: 16px; font-size: 34px; margin-bottom: 14px; }
.login-card h1 { margin: 0 0 6px; font-size: 30px; }
.login-sub { color: var(--dim); line-height: 1.5; margin: 0 0 26px; }
.login-note { color: var(--dim); font-size: 13px; line-height: 1.5; margin-top: 22px; }
.google-btn {
  display: inline-flex; align-items: center; gap: 11px;
  background: #fff; color: #1f2430; text-decoration: none; font-weight: 600;
  font-size: 15.5px; border-radius: 999px; padding: 11px 22px 11px 13px;
}
.google-btn .g-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; color: #4285f4; font-weight: 800; font-size: 17px;
}
/* Agenda */
.day { font-size: 16.5px; margin: 20px 0 10px; color: var(--accent); text-transform: capitalize; }
.event {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px 15px; margin-bottom: 10px;
}
.event-head { display: flex; align-items: center; gap: 8px; }
.event-time { color: var(--dim); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.event-title { font-size: 16.5px; font-weight: 650; margin-top: 3px; }
.event-loc { color: var(--dim); margin-top: 2px; font-size: 14.5px; }
.event-cal { font-size: 12.5px; margin-top: 2px; }
.event-note {
  margin-top: 8px; background: var(--panel2); border-radius: 9px;
  padding: 8px 10px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap;
}
.event-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn {
  display: inline-block; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:active { border-color: var(--accent); }
.badge {
  background: #5a2626; color: #ffb4b4; border-radius: 6px;
  font-size: 11px; font-weight: 700; padding: 2.5px 7px; letter-spacing: .4px;
}
.badge.ok { background: #274d2c; color: #a9e6ae; }
.event.cancelled { opacity: .55; }
.event.cancelled .event-title { text-decoration: line-through; }
.event.done { border-color: #2f5233; }
.note-editor { margin-top: 10px; }
.note-editor textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  font: inherit; font-size: 14.5px; margin-bottom: 8px;
}
.change {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); line-height: 1.4;
}
.change:first-of-type { border-top: 0; }
.badge.fact { background: #57451a; color: #ffd97a; }
.cal-chip {
  background: #233046; color: #a9c6ff; border: 1px solid #33507e;
  font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 999px;
}
.event-head, .event-title { cursor: pointer; }
.chev { color: var(--dim); margin-left: auto; font-size: 13px; }
.event-detail {
  margin-top: 9px; border-top: 1px dashed var(--line); padding-top: 9px;
  font-size: 14px; line-height: 1.5;
}
.event-desc { white-space: pre-wrap; margin-bottom: 6px; }
.event-tarif { font-size: 13px; margin-top: 3px; }
/* Formulaires (édition + section privée) */
.editor {
  margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px;
}
#create-form { border-top: 1px solid var(--line); }
.editor-title { font-weight: 700; margin-bottom: 10px; font-size: 14.5px; }
.editor label, #create-form label {
  display: block; font-size: 13px; color: var(--dim); margin-bottom: 10px;
}
.editor input[type="text"], .editor input[type="number"],
.editor input[type="datetime-local"], .editor input[type="date"],
.editor textarea, .editor select, #create-form input, #create-form textarea,
#create-form select {
  width: 100%; margin-top: 4px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px;
  font: inherit; font-size: 15px; color-scheme: dark;
}
.editor label.check, #create-form label.check {
  display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14.5px;
}
.editor label.check input, #create-form label.check input { width: auto; margin: 0; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row > label { flex: 1; min-width: 140px; }
.btn.primary { background: var(--accent); color: #14100a; border-color: var(--accent); font-weight: 650; }
.btn.danger { border-color: #7a3434; color: #ff9c9c; }
#create-btn { font-size: 13.5px; padding: 6px 13px; vertical-align: middle; margin-left: 8px; }
/* Vue semaine */
.agenda-controls {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg-btn {
  background: transparent; color: var(--dim); border: 0; padding: 8px 18px;
  font: inherit; font-size: 14px; cursor: pointer;
}
.seg-btn.active { background: var(--accent); color: #14100a; font-weight: 650; }
.week-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.week-label { font-weight: 700; font-size: 16px; margin: 4px 0 10px; }
.week-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.week-inner { min-width: 660px; }
.week-headrow, .week-allday { display: grid; grid-template-columns: 52px repeat(7, 1fr); }
.week-dayhead {
  text-align: center; padding: 8px 2px; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1px; font-size: 12px; color: var(--dim);
  text-transform: capitalize;
}
.week-dayhead strong { font-size: 17px; color: var(--text); }
.week-dayhead.today strong { color: var(--accent); }
.week-corner { font-size: 11px; display: flex; align-items: center; justify-content: center; }
.week-allday { border-top: 1px solid var(--line); }
.week-daycell { border-left: 1px solid var(--line); padding: 3px; min-height: 26px; }
.week-chip {
  font-size: 11.5px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.week-body { display: grid; grid-template-columns: 52px repeat(7, 1fr); border-top: 1px solid var(--line); }
.week-gutter { display: flex; flex-direction: column; }
.week-hourlabel { font-size: 10.5px; color: var(--dim); text-align: center; padding-top: 2px; }
.week-col {
  position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 41px, var(--line) 41px, var(--line) 42px);
}
.week-block {
  position: absolute; border-radius: 6px; padding: 3px 6px; overflow: hidden;
  cursor: pointer; font-size: 11.5px; line-height: 1.25; box-sizing: border-box;
}
.week-block.cancelled { opacity: .45; text-decoration: line-through; }
.week-block-time { font-size: 10px; opacity: .85; white-space: nowrap; }
.week-block-title { font-weight: 650; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.week-block-loc { font-size: 10px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#week-detail { margin-top: 12px; }
/* Mini-mois */
#mini-month {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 12px; max-width: 340px;
}
.mm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; text-transform: capitalize; }
.mm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mm-dow { text-align: center; font-size: 11px; color: var(--dim); padding: 3px 0; }
.mm-day {
  background: transparent; border: 0; color: var(--text); font: inherit; font-size: 13px;
  padding: 7px 0; border-radius: 999px; cursor: pointer; text-align: center;
}
.mm-day.out { color: var(--dim); opacity: .5; }
.mm-day.inweek { background: #233046; }
.mm-day.today { outline: 2px solid var(--accent); }
