/* Moi - Tableau de bord personnel */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  background: #0a1628;
  color: #e8eef7;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Lock screen */
#lock-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0a1628 0%, #13243e 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; flex-direction: column;
}
#lock-screen h1 { font-size: 48px; font-weight: 200; letter-spacing: 8px; margin-bottom: 40px; color: #d4af7a; }
.pin-display { display: flex; gap: 20px; margin-bottom: 40px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #d4af7a; transition: all 0.2s; }
.pin-dot.filled { background: #d4af7a; }
.pin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 280px; }
.pin-key {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(212, 175, 122, 0.1); border: 1px solid rgba(212, 175, 122, 0.3);
  color: #e8eef7; font-size: 28px; font-weight: 300;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.pin-key:active { background: rgba(212, 175, 122, 0.3); transform: scale(0.95); }
.pin-key.empty { background: transparent; border: none; cursor: default; }

/* Main layout */
#app { display: none; flex-direction: column; min-height: 100vh; }
#app.active { display: flex; }

header {
  padding: env(safe-area-inset-top) 20px 16px;
  background: linear-gradient(180deg, #0f1d33 0%, #0a1628 100%);
  border-bottom: 1px solid rgba(212, 175, 122, 0.15);
  position: sticky; top: 0; z-index: 50;
}
.header-top { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.section-title { font-size: 24px; font-weight: 300; color: #d4af7a; letter-spacing: 2px; }
.header-sub { font-size: 13px; color: #8fa3c0; margin-top: 4px; }

main { flex: 1; padding: 20px 16px 100px; }

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 122, 0.1);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}
.card-title { font-size: 11px; color: #d4af7a; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 12px; font-weight: 500; }
.card-content { font-size: 15px; line-height: 1.6; color: #e8eef7; }

/* Mantra card */
.mantra-card {
  background: linear-gradient(135deg, rgba(212, 175, 122, 0.15) 0%, rgba(212, 175, 122, 0.05) 100%);
  border: 1px solid rgba(212, 175, 122, 0.3);
  text-align: center;
  padding: 32px 20px;
}
.mantra-card .card-content {
  font-size: 18px; font-weight: 300; line-height: 1.6; font-style: italic; color: #f5e6d3;
}

/* Today items */
.today-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.today-item:last-child { border-bottom: none; }
.today-item .icon { font-size: 20px; width: 28px; text-align: center; }
.today-item .text { flex: 1; font-size: 14px; }
.today-item .time { font-size: 12px; color: #8fa3c0; }
.today-item .check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(212, 175, 122, 0.4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.today-item .check.done { background: #4a9d6e; border-color: #4a9d6e; }
.today-item .check.done::after { content: '✓'; color: white; font-size: 14px; }

/* Streak */
.streak-display {
  text-align: center; padding: 20px 0;
}
.streak-number {
  font-size: 48px; font-weight: 200; color: #d4af7a; line-height: 1;
}
.streak-label { font-size: 12px; color: #8fa3c0; letter-spacing: 2px; margin-top: 8px; text-transform: uppercase; }

/* Bottom navigation */
nav#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(10, 22, 40, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(212, 175, 122, 0.2);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-around;
  z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px; color: #6b7d95;
  transition: color 0.15s; cursor: pointer;
  font-size: 10px; letter-spacing: 0.5px;
}
.nav-item.active { color: #d4af7a; }
.nav-item .nav-icon { font-size: 22px; margin-bottom: 4px; }

/* Buttons */
.btn {
  display: inline-block; padding: 14px 24px;
  background: rgba(212, 175, 122, 0.15);
  border: 1px solid rgba(212, 175, 122, 0.4);
  border-radius: 12px; color: #d4af7a;
  font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  text-align: center; width: 100%;
}
.btn:active { background: rgba(212, 175, 122, 0.3); transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, #d4af7a 0%, #b8935e 100%);
  color: #0a1628; border: none;
}
.btn-danger {
  background: rgba(220, 80, 80, 0.15);
  border-color: rgba(220, 80, 80, 0.4);
  color: #ff8080;
}
.btn-sm { padding: 10px 16px; font-size: 13px; }

/* Emergency pulsion button */
.pulsion-btn {
  width: 100%;
  padding: 24px;
  background: linear-gradient(135deg, #8b2929 0%, #5a1818 100%);
  color: white; border: none; border-radius: 16px;
  font-size: 18px; font-weight: 500; letter-spacing: 1px;
  cursor: pointer; margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(139, 41, 41, 0.3);
}
.pulsion-btn:active { transform: scale(0.98); }

/* Inputs */
input, textarea, select {
  width: 100%; padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 122, 0.2);
  border-radius: 12px; color: #e8eef7;
  font-size: 15px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: #d4af7a; }
textarea { resize: none; min-height: 100px; }
label { display: block; font-size: 12px; color: #8fa3c0; margin-bottom: 6px; letter-spacing: 0.5px; }
.form-group { margin-bottom: 16px; }

/* Project list */
.project-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 122, 0.1);
  border-radius: 12px; margin-bottom: 10px;
  cursor: pointer; transition: all 0.15s;
}
.project-item:active { transform: scale(0.99); background: rgba(255, 255, 255, 0.06); }
.project-item .emoji { font-size: 24px; margin-right: 12px; }
.project-item .project-info { flex: 1; }
.project-item .project-name { font-size: 16px; font-weight: 500; }
.project-item .project-meta { font-size: 12px; color: #8fa3c0; margin-top: 2px; }
.project-item .badge {
  background: rgba(212, 175, 122, 0.2); color: #d4af7a;
  padding: 4px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
}

/* Todo list */
.todo-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.todo-item:last-child { border-bottom: none; }
.todo-item .check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(212, 175, 122, 0.4); cursor: pointer; flex-shrink: 0;
  margin-top: 2px;
}
.todo-item.done .check { background: #4a9d6e; border-color: #4a9d6e; }
.todo-item.done .check::after { content: '✓'; color: white; font-size: 14px; display: flex; align-items: center; justify-content: center; height: 100%; }
.todo-item.done .text { text-decoration: line-through; color: #6b7d95; }
.todo-item .text { flex: 1; font-size: 14px; line-height: 1.5; }
.todo-item .priority {
  font-size: 10px; padding: 2px 6px; border-radius: 6px;
  margin-top: 2px; display: inline-block;
}
.priority-P1 { background: rgba(220, 80, 80, 0.2); color: #ff8080; }
.priority-P2 { background: rgba(212, 175, 122, 0.2); color: #d4af7a; }
.priority-P3 { background: rgba(107, 125, 149, 0.2); color: #8fa3c0; }

/* Capture button (floating) */
.fab {
  position: fixed; bottom: 90px; right: 20px;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #d4af7a 0%, #b8935e 100%);
  color: #0a1628; font-size: 28px; font-weight: 300;
  border: none; cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 175, 122, 0.4);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(0.95); }

/* Modal */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: flex-end;
}
.modal.active { display: flex; }
.modal-content {
  width: 100%; background: #13243e;
  border-radius: 20px 20px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-title { font-size: 20px; font-weight: 400; color: #d4af7a; margin-bottom: 20px; }

/* Timer display */
.timer-display {
  text-align: center; padding: 40px 0;
  font-size: 64px; font-weight: 200; color: #d4af7a;
  letter-spacing: 4px;
}

/* Breathing animation */
.breathing-circle {
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 122, 0.3) 0%, rgba(212, 175, 122, 0.05) 70%);
  border: 2px solid rgba(212, 175, 122, 0.4);
  margin: 40px auto;
  transition: transform 4s ease-in-out;
}
.breathing-circle.inhale { transform: scale(1.5); }

/* Moon phase */
.moon-display {
  font-size: 32px; text-align: center; margin: 12px 0;
}

/* Hidden sections */
.section { display: none; }
.section.active { display: block; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Success feedback */
.toast {
  position: fixed; top: calc(20px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  background: rgba(74, 157, 110, 0.95);
  color: white; padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px; font-weight: 500;
  z-index: 300;
  animation: toastIn 0.3s; backdrop-filter: blur(10px);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Sport program */
.sport-session {
  padding: 16px; background: rgba(255, 255, 255, 0.03);
  border-radius: 12px; margin-bottom: 10px;
  border-left: 3px solid #d4af7a;
}
.sport-session.rest { border-left-color: #6b7d95; opacity: 0.6; }
.sport-day { font-size: 13px; color: #8fa3c0; letter-spacing: 1px; text-transform: uppercase; }
.sport-name { font-size: 16px; font-weight: 500; margin-top: 4px; }
.sport-meta { font-size: 12px; color: #8fa3c0; margin-top: 4px; }

/* Stats grid */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px; padding: 14px;
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 300; color: #d4af7a; }
.stat-label { font-size: 11px; color: #8fa3c0; margin-top: 4px; letter-spacing: 0.5px; }

/* Badges */
.badge-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge-tag {
  background: rgba(212, 175, 122, 0.15);
  color: #d4af7a; font-size: 11px;
  padding: 3px 8px; border-radius: 8px;
}

/* Empty state */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: #6b7d95;
}
.empty-state .emoji { font-size: 48px; margin-bottom: 16px; }

/* Divider */
hr { border: none; border-top: 1px solid rgba(255, 255, 255, 0.05); margin: 16px 0; }

/* Capture quick */
.capture-hint {
  font-size: 12px; color: #8fa3c0; margin-top: 8px; text-align: center;
}

/* Chat button */
.chat-fab {
  position: fixed; bottom: 90px; right: 20px;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #4a9d6e 0%, #2e7a4f 100%);
  color: white; font-size: 24px;
  border: none; cursor: pointer;
  box-shadow: 0 4px 20px rgba(74, 157, 110, 0.4);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
}
.chat-fab:active { transform: scale(0.95); }
.fab { bottom: 160px !important; }

/* Chat modal full screen */
#chat-modal {
  position: fixed; inset: 0;
  background: #0a1628;
  z-index: 300;
  display: none;
  flex-direction: column;
}
#chat-modal.active { display: flex; }
.chat-header {
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: linear-gradient(180deg, #13243e 0%, #0a1628 100%);
  border-bottom: 1px solid rgba(212, 175, 122, 0.15);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-header-title {
  font-size: 16px; font-weight: 500; color: #d4af7a;
}
.chat-close {
  background: none; border: none; color: #8fa3c0;
  font-size: 22px; cursor: pointer; padding: 8px;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg {
  max-width: 85%; padding: 12px 16px;
  border-radius: 18px; font-size: 15px;
  line-height: 1.5; word-wrap: break-word;
}
.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #d4af7a 0%, #b8935e 100%);
  color: #0a1628; border-bottom-right-radius: 4px;
}
.msg-ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  color: #e8eef7; border: 1px solid rgba(212, 175, 122, 0.15);
  border-bottom-left-radius: 4px;
}
.msg-tool {
  align-self: center;
  background: rgba(74, 157, 110, 0.15);
  border: 1px solid rgba(74, 157, 110, 0.3);
  color: #8fd3a8;
  font-size: 12px; padding: 6px 12px;
  border-radius: 12px;
}
.msg.thinking {
  align-self: flex-start; color: #6b7d95;
  font-style: italic; padding: 8px 12px;
}
.chat-input-area {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #13243e;
  border-top: 1px solid rgba(212, 175, 122, 0.15);
  display: flex; gap: 8px; align-items: flex-end;
}
.chat-input {
  flex: 1; padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 122, 0.2);
  border-radius: 20px; color: #e8eef7;
  font-size: 15px; font-family: inherit;
  outline: none; resize: none;
  max-height: 120px; min-height: 42px;
}
.chat-input:focus { border-color: #d4af7a; }
.chat-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #d4af7a 0%, #b8935e 100%);
  color: #0a1628; border: none; cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-send:disabled { opacity: 0.4; }
.chat-send:active { transform: scale(0.95); }
.chat-empty {
  text-align: center; padding: 40px 20px; color: #6b7d95;
}
.chat-empty .emoji { font-size: 48px; margin-bottom: 16px; }
.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px;
  justify-content: center;
}
.chat-suggestion {
  padding: 8px 14px;
  background: rgba(212, 175, 122, 0.1);
  border: 1px solid rgba(212, 175, 122, 0.3);
  border-radius: 16px; color: #d4af7a;
  font-size: 13px; cursor: pointer;
}
.chat-suggestion:active { background: rgba(212, 175, 122, 0.2); }

/* Chat mic button */
.chat-mic {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(212, 175, 122, 0.15);
  border: 1px solid rgba(212, 175, 122, 0.3);
  color: #d4af7a; cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chat-mic.listening {
  background: rgba(255, 128, 128, 0.3);
  border-color: #ff8080;
  animation: pulse 1s infinite;
}
.chat-mic:active { transform: scale(0.95); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

.speak-btn {
  background: none; border: none; cursor: pointer;
  color: #6b7d95; font-size: 14px;
  margin-left: 8px; padding: 2px 6px;
  vertical-align: middle;
}
.speak-btn:active { color: #d4af7a; }

#chat-speaker.active { color: #d4af7a; }

/* Plus menu */
.plus-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.plus-item {
  padding: 20px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 122, 0.15);
  border-radius: 16px; text-align: center;
  cursor: pointer; transition: all 0.15s;
}
.plus-item:active { transform: scale(0.95); background: rgba(255, 255, 255, 0.08); }
.plus-icon { font-size: 32px; margin-bottom: 8px; }
.plus-item > div:last-child { font-size: 12px; color: #e8eef7; }

/* Date item (couple, etc.) */
.date-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.date-item:last-child { border-bottom: none; }

/* Objective item */
.obj-item {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.obj-item:last-child { border-bottom: none; }
.progress-bar {
  width: 100%; height: 6px; margin-top: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4af7a, #b8935e);
  border-radius: 3px; transition: width 0.3s;
}

/* Book item */
.book-item {
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 122, 0.15);
  border-radius: 12px; margin-bottom: 12px;
}

/* Calendar */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header {
  font-size: 11px; color: #8fa3c0;
  text-align: center; padding: 8px 0;
  letter-spacing: 1px; text-transform: uppercase;
}
.cal-day {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px; padding: 6px 4px;
  cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  min-height: 44px;
}
.cal-day.empty { background: transparent; border: none; cursor: default; }
.cal-day.today { border-color: #d4af7a; background: rgba(212, 175, 122, 0.1); }
.cal-day.future { opacity: 0.55; }
.cal-day:active:not(.empty) { transform: scale(0.95); }
.cal-num { font-weight: 500; color: #e8eef7; font-size: 12px; }
.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; }
.cal-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%;
}
.cal-dot-ritual { background: #d4af7a; }
.cal-dot-sport { background: #4a9d6e; }
.cal-dot-event { background: #ec4899; }
