/*
 * Coquille « bureau » : pas de barre latérale. Le contenu repose sur un fond qui prend
 * la couleur du moment de la journée ; la navigation flotte au-dessus, en verre.
 */

.app { min-height: 100dvh; }

/* --- Barre de navigation (écran large : en haut) --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 24px 10px;
  pointer-events: none; /* seuls les groupes flottants captent le pointeur */
}
.topbar > * { pointer-events: auto; }
/* Fondu du contenu sous la barre flottante (scroll edge). */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -24px;
  z-index: -1;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent) 40%, transparent);
  pointer-events: none;
}

.glass, .nav, .nav-search, .nav-round, .nav-tab-search {
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--shadow-md), 0 0 0 0.5px color-mix(in srgb, var(--text) 12%, transparent), inset 0 0.5px 0 rgb(255 255 255 / 0.4);
}

.brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent-fill) 80%, #fff), var(--accent-fill));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3);
  color: #fff;
  display: grid;
  place-items: center;
}

.nav { list-style: none; margin: 0; padding: 4px; display: flex; gap: 2px; border-radius: 999px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 560;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-link:hover { background: color-mix(in srgb, var(--text) 6%, transparent); text-decoration: none; }
.nav-link.is-active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); font-weight: 650; }
:root[data-theme="dark"] .nav-link.is-active { background: color-mix(in srgb, var(--text) 14%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav-link.is-active { background: color-mix(in srgb, var(--text) 14%, transparent); } }

.nav-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--badge);
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
}

.nav-tools { justify-self: end; display: flex; align-items: center; gap: 10px; }
.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  min-width: 210px;
  padding: 0 8px 0 14px;
  border-radius: 999px;
  color: var(--text-3);
  font-size: 14px;
  text-decoration: none;
}
.nav-search:hover { text-decoration: none; color: var(--text-2); }
.nav-search.is-active { box-shadow: var(--shadow-md), 0 0 0 2px var(--accent); }
.nav-search__label { flex: 1; }
.nav-search__kbd {
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
}
.nav-round {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-2);
}
.nav-round:hover, .nav-round.is-active { color: var(--accent); }
.nav-tab-search { display: none; }

/* --- Zone principale --- */

.main { min-width: 0; padding: 18px 32px 64px; outline: none; }

/* Panneau plein écran d'un module : un widget « agrandi » posé sur le fond. */
.panel {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 32px 32px;
  border-radius: var(--r-panel);
  background: var(--surface);
  box-shadow: var(--shadow-md), 0 0 0 1px color-mix(in srgb, var(--text) 5%, transparent);
}

/* Dans un panneau (écran large), les blocs internes perdent leur ombre : simples groupes à filet. */
@media (min-width: 768px) {
  .panel .card, .panel .month, .panel .tg, .panel .search-list, .panel .quick-add,
  .panel .tasks-main > .task-list:not(:empty), .panel .tasks-done .task-list {
    box-shadow: 0 0 0 1px var(--border);
  }
  .panel .search-field { box-shadow: 0 0 0 1px var(--border-strong); }
  .panel .search-field:focus-within { box-shadow: 0 0 0 1px var(--accent), var(--focus); }
  .panel.notes-layout { padding: 0; overflow: hidden; }
  .panel.search, .panel.settings { max-width: 820px; }
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 16px;
  margin-bottom: 20px;
}
.view-head__titles { min-width: 0; }
.view-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: var(--tracking-title);
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.view-sub { margin-top: 4px; color: var(--text-3); font-size: 15px; }
.view-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

@media (max-width: 1100px) {
  .brand { padding-right: 5px; }
  .brand__name { display: none; }
  .nav-search { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .nav-search__label, .nav-search__kbd { display: none; }
}

@media (max-width: 767px) {
  /* Barre d'onglets flottante (iOS) + onglet Recherche détaché à droite. */
  .topbar {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    display: flex;
    gap: 8px;
    padding: 0;
  }
  .brand, .nav-tools { display: none; }
  .topbar::before { display: none; }
  .nav { flex: 1; justify-content: space-around; gap: 0; }
  .nav li { flex: 1; min-width: 0; }
  .nav-link {
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-height: 52px;
    padding: 4px 2px;
    font-size: 10.5px;
    font-weight: 600;
    text-align: center;
  }
  .nav-link.is-active { box-shadow: none; }
  .nav-link__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-badge {
    position: absolute;
    top: 3px;
    left: calc(50% + 5px);
    min-width: 17px;
    height: 17px;
    font-size: 10.5px;
  }
  .nav-tab-search {
    display: grid;
    place-items: center;
    flex: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: var(--text);
  }
  .nav-tab-search.is-active { color: var(--accent); }

  /* Fondu du contenu sous la barre flottante (scroll edge). */
  .app::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(96px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 25%, transparent);
    pointer-events: none;
    z-index: 15;
  }

  .main { padding: 18px 16px calc(100px + env(safe-area-inset-bottom)); }
  .panel { padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .view-title { font-size: 30px; }
  .hide-sm { display: none; }
}
