:root {
  --ink: #1c1917;
  --bg: #131010;
  --card: #1d1917;
  --card-2: #241f1c;
  --line: #2c2724;
  --text: #fafaf9;
  --muted: #a29a94;
  --orange: #f97316;
  --orange-soft: rgba(249, 115, 22, 0.14);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

button, input { font-family: inherit; color: inherit; }

a { color: var(--orange); text-decoration: none; }

/* ---------- header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
  background: linear-gradient(180deg, rgba(19, 16, 16, 0.96) 60%, rgba(19, 16, 16, 0.72));
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
}

.head-right { display: flex; align-items: center; gap: 10px; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: #3a3430; }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- layout ---------- */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px 24px;
}

.view-enter > * { animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
  .view-enter > * { animation: none; }
}

/* ---------- hero du jour ---------- */
.hero { padding: 22px 4px 18px; }
.hero .eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 600;
}
.hero h1 {
  margin: 8px 0 6px;
  font-size: 27px;
  line-height: 1.15;
  font-weight: 620;
  letter-spacing: -0.02em;
}
.hero .sub { color: var(--muted); font-size: 14px; }

.day-nav { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.day-nav .today-btn {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.day-nav .today-btn:hover { color: var(--orange); border-color: var(--orange); }

/* ---------- sections ---------- */
.section { margin-top: 22px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 4px 10px;
}
.section-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-head .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- timeline ---------- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 8px; }

.event {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: stretch;
}
.event .when {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.3;
}
.event .when b { display: block; font-weight: 600; color: var(--text); font-size: 13.5px; }

.event .body {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px 12px 16px;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.event .body:hover { border-color: #3a3430; }
.event .body::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}
.event[data-family="pro"] .body::before { background: var(--orange); }
.event[data-family="perso"] .body::before { background: rgba(249, 115, 22, 0.55); }
.event[data-family="holiday"] .body { background: transparent; }
.event[data-family="holiday"] .body::before { background: transparent; }

.event.is-now .body { border-color: var(--orange); background: var(--orange-soft); }

.event h3 { margin: 0; font-size: 15px; font-weight: 590; line-height: 1.32; }
.event .meta {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.event .meta .cal { display: inline-flex; align-items: center; gap: 5px; }
.event .meta .cal::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--orange);
}
.event[data-family="perso"] .meta .cal::before { background: var(--orange); border-color: var(--orange); opacity: 0.6; }
.event[data-family="holiday"] .meta .cal::before { border-color: var(--muted); opacity: 0.5; }

.event .teams {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  font-size: 12px;
  font-weight: 550;
  color: var(--orange);
}
.event .teams svg { width: 13px; height: 13px; }

/* ---------- feed ---------- */
.feed { display: flex; flex-direction: column; gap: 10px; }

.feed-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.feed-item:hover { border-color: #3a3430; }
.feed-item:active { background: var(--card-2); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text);
  background: #2a2320;
  border: 1px solid #3a322c;
}
.avatar.hermy { background: var(--orange); color: var(--ink); border-color: var(--orange); }

.feed-item .head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.feed-item .who { font-size: 13px; font-weight: 620; }
.feed-item .role { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.feed-item .stamp { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.feed-item .text {
  font-size: 13.5px;
  color: #ded8d3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-item.open .text { display: block; -webkit-line-clamp: unset; }

.feed-item .more {
  margin-top: 7px;
  font-size: 12px;
  color: var(--orange);
  font-weight: 550;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 26px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.next-up {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.next-up .k { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.next-up b { font-size: 13.5px; font-weight: 600; }
.next-up span:last-child { font-size: 11.5px; color: var(--muted); }

/* ---------- agenda / mois ---------- */
.month-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 14px 12px;
}
.month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}
.month-head .label { font-size: 15px; font-weight: 600; text-transform: capitalize; }
.month-head .nav { display: flex; gap: 6px; }

.grid7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.grid7 .dow {
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 6px;
}

.day-cell {
  position: relative;
  aspect-ratio: 1 / 1.06;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: background 0.18s, border-color 0.18s;
}
.day-cell:hover { background: #221d1a; }
.day-cell.out { color: #5c5450; }
.day-cell.today { border-color: var(--orange); color: var(--orange); font-weight: 650; }
.day-cell.selected { background: var(--orange); color: var(--ink); font-weight: 650; }
.day-cell .dots { display: flex; gap: 3px; height: 5px; }
.day-cell .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--orange); display: block; }
.day-cell.selected .dots i { background: var(--ink); }
.day-cell .dots i.perso { opacity: 0.55; }

.day-list { margin-top: 16px; }

/* ---------- journal ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin: 4px 0 14px; }

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 12px;
  color: var(--muted);
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
}
.search input::placeholder { color: #6f6661; }
.search svg { width: 15px; height: 15px; flex: none; }

.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 16px 4px;
  margin: 0 -16px 8px;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 0, #000 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 94%, transparent 100%);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { color: var(--text); border-color: #3a3430; }
.chip.active { background: var(--orange); border-color: var(--orange); color: var(--ink); font-weight: 600; }
.chip .n { font-size: 10.5px; opacity: 0.7; font-variant-numeric: tabular-nums; }

.day-group { margin-top: 20px; }
.day-group > .label {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 4px 8px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.day-group > .label span { letter-spacing: 0; text-transform: none; font-size: 11px; opacity: 0.7; }

/* ---------- agents ---------- */
.agent-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .agent-grid { grid-template-columns: 1fr 1fr; } }

.agent-card {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.agent-card:hover { border-color: #3a3430; transform: translateY(-1px); }
.agent-card .top { display: flex; align-items: center; gap: 10px; }
.agent-card .name { font-size: 14.5px; font-weight: 620; }
.agent-card .role { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.agent-card .week { margin-left: auto; font-size: 11.5px; color: var(--orange); font-variant-numeric: tabular-nums; }
.agent-card .last {
  margin-top: 10px;
  font-size: 12.5px;
  color: #cfc8c2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-card .stamp { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* ---------- bottom nav ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(23, 19, 17, 0.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: #7d736c;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 12px;
  transition: color 0.18s;
}
.tab svg { width: 20px; height: 20px; }
.tab.active { color: var(--orange); }

@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .tabbar {
    position: sticky;
    bottom: 18px;
    width: fit-content;
    margin: 0 auto 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px;
    gap: 4px;
  }
  .tab { flex: none; flex-direction: row; gap: 7px; padding: 8px 16px; font-size: 12.5px; }
  .tab svg { width: 16px; height: 16px; }
}

/* ---------- sheet ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 8, 8, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #171311;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border: 1px solid var(--line);
  border-bottom: 0;
  transform: translateY(102%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet.show { transform: none; }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; width: 640px; transform: translate(-50%, 102%); border-radius: 24px; bottom: 24px; border-bottom: 1px solid var(--line); }
  .sheet.show { transform: translate(-50%, 0); }
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-head .t { font-size: 14px; font-weight: 620; }
.sheet-head .s { font-size: 11.5px; color: var(--muted); }
.sheet-head .icon-btn { margin-left: auto; }

.sheet-body { overflow-y: auto; overflow-x: hidden; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }

.bubble {
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 13.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
}
.bubble.user { background: var(--orange-soft); border: 1px solid rgba(249, 115, 22, 0.28); align-self: flex-end; max-width: 88%; }
.bubble.assistant { background: var(--card); border: 1px solid var(--line); }
.bubble .t { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }

.skeleton { height: 74px; border-radius: var(--radius); background: linear-gradient(90deg, #1d1917, #241f1c, #1d1917); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
