/* Recherche globale et centre de notifications. */

html:has(.shell-dialog[open]) { overflow: hidden; }

.shell-dialog {
  --shell-ease: cubic-bezier(.2, .7, .2, 1);
  position: fixed;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.shell-dialog[open] {
  display: grid;
  animation: shell-enter 175ms var(--shell-ease) both;
}

.shell-dialog::backdrop {
  background: oklch(0.20 0.05 335 / .48);
}

.notification-drawer::backdrop {
  background: oklch(0.20 0.05 335 / .24);
}

@keyframes shell-enter {
  from { opacity: 0; transform: translateY(-6px) scale(.991); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-palette {
  inset: clamp(22px, 10dvh, 104px) 0 auto;
  width: min(940px, calc(100% - 52px));
  max-width: none;
  height: min(680px, 81dvh);
  max-height: none;
  margin: 0 auto;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.palette-head {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  padding: 8px 17px 8px 23px;
  background: var(--prune-900);
  color: var(--on-primary);
}

.palette-head > .icon {
  width: 25px;
  height: 25px;
  color: var(--on-dark-muted);
}

.palette-head input {
  width: 100%;
  min-width: 0;
  min-height: 49px;
  padding-inline: 5px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: inherit;
  font: 400 clamp(17px, 3vw, 26px)/1.2 var(--font-sans);
}

.palette-head input::placeholder { color: var(--on-dark-muted); opacity: 1; }
.palette-head input:focus-visible { outline: 2px solid var(--lake-bright); outline-offset: 1px; }
.palette-head .shell-close { color: inherit; }
.palette-head .shell-close:hover { background: var(--prune-800); }

.search-launch kbd,
.palette-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  min-height: 22px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-page);
  color: var(--text-secondary);
  font: 500 12px var(--font-sans);
  white-space: nowrap;
}

.shell-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  padding: 8px 15px;
  border-bottom: 1px solid var(--border);
}

.shell-filters[hidden] { display: none; }
.shell-filters button {
  flex: none;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: 500 14px var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms var(--shell-ease), color 140ms var(--shell-ease);
}

.shell-filters button:hover { background: var(--bg-sunken); }
.shell-filters button[aria-pressed="true"] {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary);
}
.shell-filters button span { margin-inline-start: 3px; font-variant-numeric: tabular-nums; }

.palette-body {
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}
.palette-body.has-preview { grid-template-columns: minmax(0, 1.63fr) minmax(0, 1fr); }
.palette-scroll, .notice-feed {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.palette-scroll { padding: 8px 12px 15px; }
.palette-group + .palette-group { margin-block-start: 13px; }
.palette-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: var(--text-secondary);
  font: 600 14px var(--font-sans);
}
.palette-group h3 span, .notice-domain h4 span, .notice-section h3 span {
  color: var(--text-muted);
  font: 600 13px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.palette-result {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 6px 9px;
  border-radius: var(--radius-m);
  cursor: pointer;
  transition: background-color 130ms var(--shell-ease);
}
.palette-result[aria-selected="true"] { background: var(--primary-soft); }
.palette-result > .icon { width: 15px; color: var(--text-muted); }
.palette-result-copy { display: grid; line-height: 1.3; overflow-wrap: anywhere; }
.palette-result-copy strong { text-wrap: pretty; }
.palette-result-copy small { color: var(--text-secondary); }
.palette-result mark {
  padding: 0 1px;
  border-radius: 2px;
  background: var(--amber-soft);
  color: var(--prune-950);
}
.shell-glyph {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-m);
  background: var(--bg-sunken);
  color: var(--primary);
}
.shell-glyph .icon { width: 18px; height: 18px; }
.palette-result[aria-selected="true"] .shell-glyph { background: var(--bg-surface); }
.palette-empty { padding: 13px 10px; color: var(--text-secondary); overflow-wrap: anywhere; }

.palette-preview {
  min-width: 0;
  min-height: 0;
  padding: clamp(18px, 3vw, 32px);
  border-inline-start: 1px solid var(--border);
  background: var(--bg-page);
  overflow: auto;
  overscroll-behavior: contain;
}
.palette-preview:empty { display: none; }
.preview-emblem {
  display: grid;
  place-items: center;
  width: 62px;
  height: 70px;
  margin-block-end: 20px;
  border-radius: var(--radius-arch);
  color: var(--primary);
  background: var(--primary-soft);
}
.preview-emblem .icon { width: 27px; height: 27px; }
.palette-preview h3 {
  margin: 3px 0 9px;
  color: var(--prune-950);
  font: 400 clamp(24px, 3.15vw, 37px)/1.12 var(--font-display);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}
.palette-preview p { color: var(--text-secondary); overflow-wrap: anywhere; }
.preview-kind { font-size: var(--text-s); font-weight: 600; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 20px; }
.preview-actions .button { min-height: 44px; text-wrap: balance; white-space: normal; }
.palette-foot {
  grid-row: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 45px;
  padding: 7px 17px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-s);
}
.palette-keys { display: flex; align-items: center; gap: 5px; }
.palette-keys kbd:not(:first-child) { margin-inline-start: 7px; }

.notification-drawer {
  inset: var(--bell-bottom, 68px) var(--bell-right, 20px) auto auto;
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: min(760px, calc(100dvh - var(--bell-bottom, 68px) - 14px));
  margin: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
}
.notice-head, .notice-heading { display: flex; align-items: center; gap: 12px; }
.notice-head {
  justify-content: space-between;
  padding: 18px 16px 14px 20px;
  background: var(--prune-900);
  color: var(--on-primary);
}
.notice-head .shell-glyph { background: var(--prune-800); color: var(--on-primary); }
.notice-head h2 { font: 400 clamp(24px, 4vw, 32px)/1.13 var(--font-display); }
.notice-head p { margin-block-start: 3px; color: var(--on-dark-muted); font-size: var(--text-s); }
.notice-head .shell-close { color: inherit; }
.notice-head .shell-close:hover { background: var(--prune-800); }
.notice-toolbar { display: grid; gap: 12px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
/* Deux onglets pleine largeur : jamais de défilement horizontal, même sur un petit écran. */
.notice-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-m); background: var(--bg-sunken); }
.notice-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--radius-m) - 3px);
  background: transparent;
  color: var(--text-secondary);
  font: 600 14px var(--font-sans);
  cursor: pointer;
  transition: background-color 140ms var(--shell-ease), color 140ms var(--shell-ease);
}
.notice-tabs button:hover { color: var(--text-primary); }
.notice-tabs button[aria-pressed="true"] { background: var(--bg-surface); color: var(--primary); box-shadow: 0 1px 2px rgb(43 18 48 / 12%); }
.notice-tabs span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.notice-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.notice-domain-filter { flex: 1 1 200px; max-width: 260px; }
.notice-domain-filter[hidden] { display: none; }
.notice-domain-filter select {
  width: 100%;
  min-height: 40px;
  padding-block: 0;
  padding-inline-start: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font: 500 14px var(--font-sans);
}
.notice-domain-filter select:hover { border-color: var(--primary-line); }
.notice-tools .notice-mark { margin-inline-start: auto; }
.notice-feed { overflow-x: hidden; }
.notice-read {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-s);
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font: 600 14px var(--font-sans);
}
.notice-read:hover { background: var(--primary-soft); }
.notice-read[aria-disabled="true"] { color: var(--text-muted); cursor: default; }
.notice-read .icon { width: 17px; height: 17px; }
.notice-feed { grid-row: 3; padding: 15px 18px 20px; }
.notice-section + .notice-section { margin-block-start: 24px; }
.notice-section h3 {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-block-end: 10px;
  font: 400 24px/1.15 var(--font-display);
}
.notice-domain {
  margin-block-end: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.notice-domain h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  margin: 0;
  padding: 6px 11px;
  background: var(--bg-sunken);
  color: var(--prune-900);
  font-weight: 600;
}
.notice-domain h4 .icon { width: 16px; height: 16px; }
.notice-domain summary {
  min-height: 44px;
  padding: 11px;
  border-top: 1px solid var(--border);
  color: var(--primary);
  cursor: pointer;
}
.notice-feed ul { margin: 0; padding: 0; list-style: none; }
.notice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 10px;
}
.notice-section > ul .notice-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
.notice-row + .notice-row { border-top: 1px solid var(--border); }
.notice-row .button { align-self: center; min-height: 44px; max-width: 118px; white-space: normal; text-wrap: balance; text-align: center; }
.notice-copy { min-width: 0; line-height: 1.28; overflow-wrap: anywhere; }
.notice-copy strong { text-wrap: pretty; }
.notice-copy p { color: var(--text-secondary); margin: 2px 0; }
.notice-copy small { color: var(--text-muted); }
.notice-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-start: 7px;
  border-radius: 50%;
  background: var(--primary);
  vertical-align: 2px;
}
.notice-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px;
  border-radius: var(--radius-m);
  background: var(--bg-page);
  color: var(--text-secondary);
}
.notice-empty .icon { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .shell-dialog.search-palette, .shell-dialog.notification-drawer {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .shell-dialog.search-palette { height: var(--palette-height, 100dvh); }
  .palette-head {
    grid-template-columns: 21px minmax(0, 1fr) 44px;
    gap: 7px;
    min-height: 64px;
    padding-inline: 12px 8px;
  }
  .palette-head > .icon { width: 20px; height: 20px; }
  .palette-body.has-preview { grid-template-columns: minmax(0, 1fr); }
  .palette-preview, .palette-keys, .search-launch kbd { display: none; }
  .palette-scroll { padding-inline: 8px; }
  .shell-filters button { min-height: 44px; }
  .notice-feed { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .shell-dialog[open] { animation: none; }
  .search-launch, .palette-result, .shell-filters button { transition: none; }
}
