/* Élan — app-level styles: layout, auth, responsive mobile/desktop. */
html { color-scheme: dark; }
html, body { min-height: 100%; }
body { margin: 0; }
#root { min-height: 100vh; display: flex; flex-direction: column; }

::placeholder { color: var(--color-neutral-600); }

/* quiet inline input (agenda rows, priorities) */
input.qi {
  background: transparent; border: none; border-bottom: 1px solid var(--color-divider);
  border-radius: 0; min-height: 30px; padding: 3px 2px; font-size: 13.5px; width: 100%;
  color: var(--color-text); caret-color: var(--color-accent); font-family: inherit;
}
input.qi:focus-visible { outline: none; border-bottom-color: var(--color-accent); }

/* bouton calendrier (tâches) — icône visible partout, <input date> natif invisible par-dessus */
.date-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 30px; padding: 0 8px; flex: none; cursor: pointer;
  border: 1px solid var(--color-divider); border-radius: 8px;
  font-size: 14px; color: var(--color-neutral-300);
}
.date-btn:hover { border-color: var(--color-accent); }
.date-input-hidden {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; margin: 0; -webkit-appearance: none; appearance: none;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .4s ease both; }

/* ── auth ── */
.auth-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px; position: relative;
}
.auth-lang { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }
.auth-card { width: min(360px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 26px; text-align: left; }
.auth-err { color: #e08c8c; font-size: 12.5px; margin: 0; }
.auth-switch { display: flex; align-items: baseline; gap: 6px; justify-content: center; margin-top: 18px; font-size: 13px; }

/* ── SMART panel ── */
.smart-panel { margin-left: 38px; }
@media (max-width: 720px) { .smart-panel { margin-left: 0; } }

/* ── drag & drop des habitudes ── */
.drag-handle {
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  color: var(--color-neutral-600); font-size: 15px; line-height: 1;
  padding: 2px 5px; flex: none; border-radius: var(--radius-sm);
}
.drag-handle:hover { color: var(--color-accent); background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.habit-row.dragging { opacity: .55; background: color-mix(in srgb, var(--color-accent) 8%, transparent); border-radius: var(--radius-md); }
.habit-row.dragging .drag-handle { cursor: grabbing; }

/* swipe vers la gauche pour supprimer */
.habit-row {
  position: relative; overflow: hidden; touch-action: pan-y;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.swipe-content {
  display: flex; flex-direction: column; gap: 7px; padding: 10px 2px;
  background: var(--color-bg); position: relative; z-index: 1;
}
.swipe-bg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 18px; font-size: 13px; color: #e08c8c; opacity: 0;
  background: color-mix(in srgb, #e08c8c 10%, transparent); border-radius: var(--radius-md);
}
.habit-row.swiping .swipe-bg { opacity: 1; }
.habit-row.swipe-armed .swipe-bg { background: color-mix(in srgb, #e08c8c 22%, transparent); font-weight: 500; }

/* ── top nav ── */
.app-nav {
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
  background: color-mix(in srgb, var(--color-bg) 90%, transparent); backdrop-filter: blur(10px);
  padding-top: calc(8.4px + env(safe-area-inset-top, 0px));
}
.nav-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.nav-side { display: flex; align-items: center; gap: 6px; }
.nav-user { font-size: 12.5px; }

/* ── bottom tab bar (mobile) ── */
.tabbar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--color-bg) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
}
.tabbar .btn { flex: 1; font-size: 12px; padding: 6px 2px; }

/* ── layout helpers ── */
.app-main { max-width: 880px; width: 100%; margin: 0 auto; flex: 1; }
.onb { flex: 1; max-width: 560px; width: 100%; margin: 0 auto; padding: 64px 24px; }
.day-cols { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px 32px; align-items: flex-start; }
.day-col { flex: 1 1 330px; min-width: 300px; display: flex; flex-direction: column; gap: 16px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 6px 16px 2px; }
.year-grid { padding: 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }

/* ── app native (Capacitor) : zones de sécurité iPhone ── */
html.is-native .auth-lang { top: 62px; }
html.is-native .app-nav { padding-top: 58px; }
html.is-native .tabbar { padding-bottom: 30px; }
html.is-native .auth-wrap { padding-top: 70px; }
/* Android : la WebView commence déjà sous la barre d'état — on annule les marges iPhone */
html.is-android .auth-lang { top: 14px; }
html.is-android .app-nav { padding-top: 8.4px; }
html.is-android .tabbar { padding-bottom: 12px; }
html.is-android .auth-wrap { padding-top: 48px; }

/* ── responsive ── */
@media (max-width: 720px) {
  .nav-tabs { display: none; }
  .tabbar { display: flex; }
  .app-main { padding-bottom: 76px; }
  .onb { padding: 40px 20px 56px; }
  h1 { font-size: 36px; }
  .onb h2 { font-size: 24px; }
  .pager h3 { font-size: 19px; }
  .pager > div { min-width: 0 !important; }
  .day-cols { padding: 14px 12px 28px; }
  .day-col { min-width: 260px; }
  .year-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding-bottom: 8px; }
  .nav-user { display: none; }
}
