/* Stage 3: search, bell, favourites, my cards, feeds, reactions, fields, calendar, admin */

/* Header tools: search field, bell */
.top-search {
  position: relative; margin-left: auto; display: flex; align-items: center;
  width: min(300px, 32vw);
}
.top-search > .icon { position: absolute; left: 10px; font-size: 15px; color: var(--ink-4); pointer-events: none; }
.top-search .field { min-height: 34px; padding-left: 32px; padding-right: 30px; }
.top-search .field::-webkit-search-cancel-button { display: none; }
.key-hint {
  position: absolute; right: 8px; min-width: 18px; height: 18px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 5px; color: var(--ink-4);
  font-family: var(--ff-mono); font-size: var(--fs-xs); pointer-events: none;
}
.top-search .field:focus ~ .key-hint { display: none; }
.topbar .spacer + .top-search, .board-head .top-search { margin-left: 0; }
.search-link { display: none; }
.bell { position: relative; }
.bell-count, .nav-count {
  min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); background: var(--bad); color: var(--on-accent);
  font-size: var(--fs-xs); font-weight: 800; line-height: 1;
}
.bell-count { position: absolute; top: -2px; right: -4px; box-shadow: 0 0 0 2px var(--card); }
.nav a .nav-count { margin-left: auto; }
@media (max-width: 1700px) {
  .board-head .top-search { display: none; }
  .board-head .search-link { display: inline-grid; }
}
@media (max-width: 1024px) {
  .top-search { display: none; }
  .search-link { display: inline-grid; }
  .topbar h1 + .search-link { margin-left: auto; }
}
@media (max-width: 1439px) and (min-width: 1025px) {
  body:not(.rail-open) .nav a .nav-count { position: absolute; margin: -18px 0 0 22px; }
  body:not(.rail-open) .nav a { position: relative; }
  body:not(.rail-open) .favorites a span { display: none; }
  body:not(.rail-open) .favorites a { justify-content: center; padding: 0; width: 44px; }
}

/* Bell popover */
.pop.bell-pop { width: min(380px, calc(100vw - 32px)); }
.bell-pop .note-list { max-height: min(60vh, 460px); overflow-y: auto; margin: 0 -6px; }
.bell-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 8px; }
.note-list { display: grid; gap: 2px; }
.note {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 10px;
  border-radius: var(--r-2); color: var(--ink-2);
}
.note:hover { background: var(--hover-tint); color: var(--ink); }
.note.unread { background: var(--chip-on-bg); color: var(--ink); }
.note-mark {
  width: 30px; height: 30px; flex: 0 0 auto; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); background: var(--none-bg); color: var(--ink-3);
}
.note-mark .icon { font-size: 15px; }
.note-mark.kind-due { background: var(--warn-bg); color: var(--warn); }
.note-mark.kind-mentioned { background: var(--badge-bg); color: var(--badge-ink); }
.note-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.note-copy b { font-size: var(--fs-md); font-weight: 700; overflow-wrap: anywhere; }
.note-copy small { color: var(--ink-4); font-size: var(--fs-xs); }
.note-quote { color: var(--ink-3) !important; font-size: var(--fs-sm) !important;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-dot { width: 8px; height: 8px; margin-top: 6px; flex: 0 0 auto; border-radius: var(--r-pill); background: var(--violet); }
.bell-empty { padding: 18px 8px; color: var(--ink-3); text-align: center; font-size: var(--fs-md); }

/* Favourites in the sidebar */
.favorites { display: grid; gap: 2px; }
.favorites a {
  min-height: 32px; display: flex; align-items: center; gap: 10px; padding: 0 10px;
  border-radius: var(--r-1); color: var(--ink-2); font-size: var(--fs-md);
}
.favorites a span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.favorites a:hover { background: var(--hover-tint); color: var(--ink); }
.favorites a.active { color: var(--badge-ink); background: var(--badge-bg); font-weight: 700; }
.star-on, .star.on .icon { color: var(--warn); fill: currentColor; }
.star .icon { font-size: 17px; }
.board-head .star { width: 32px; height: 32px; }

/* Search, my cards */
.search-big { position: relative; display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.search-big > .icon { position: absolute; left: 14px; font-size: 18px; color: var(--ink-4); pointer-events: none; }
.search-big .field { flex: 1; min-height: 44px; padding-left: 42px; font-size: var(--fs-base); }
.search-big .btn { min-height: 44px; }
.find-summary { margin: 0 0 12px; }
.find-list { display: grid; gap: 8px; }
.find-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-3); background: var(--card); color: var(--ink);
}
.find-row:hover { border-color: var(--line-strong); color: var(--ink); box-shadow: 0 1px 0 var(--line); }
.find-mark { width: 6px; align-self: stretch; flex: 0 0 auto; border-radius: var(--r-pill); background: var(--tone-g); }
.find-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.find-copy b { font-size: var(--fs-base); font-weight: 700; overflow-wrap: anywhere; }
.find-copy small { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--ink-3); font-size: var(--fs-sm); }
.find-copy .chip { min-height: 20px; padding: 0 7px; font-size: var(--fs-xs); }
.find-snippet { display: block; color: var(--ink-3); font-size: var(--fs-md); overflow-wrap: anywhere; }
.find-snippet .icon { margin-right: 6px; font-size: 13px; vertical-align: -2px; }
.find-snippet mark, .note mark { padding: 0 2px; border-radius: 3px; background: var(--warn-bg); color: var(--ink); }
.find-group { margin-bottom: 22px; }
.find-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: var(--fs-lg); }
.find-group-title small { color: var(--ink-4); font-size: var(--fs-md); }
.find-group-title.bad { color: var(--bad); }

/* Feed */
.feed { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 2px; }
.feed-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.feed-row:last-child { border-bottom: 0; }
.feed-copy { min-width: 0; flex: 1; font-size: var(--fs-md); color: var(--ink-2); overflow-wrap: anywhere; }
.feed-copy b { color: var(--ink); }
.feed-copy a { color: var(--ink); }
.feed-copy a:hover { color: var(--violet-2); }
.feed-copy small { display: block; color: var(--ink-4); font-size: var(--fs-xs); }
.feed-copy .chip { min-height: 20px; padding: 0 7px; font-size: var(--fs-xs); }
.card-feed .feed-row { padding: 6px 0; }
.card-feed .feed-copy { font-size: var(--fs-sm); }

/* Card: watching, template, fields, reactions, mentions */
.template-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px;
  border-radius: var(--r-1); background: var(--badge-bg); color: var(--badge-ink); font-weight: 700;
}
.template-note .spacer { flex: 1; }
.watch-chip[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--badge-ink); border-color: var(--chip-on-ring); }
.fields-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.field-cell { display: grid; gap: 4px; min-width: 0; }
.field-cell .eyebrow { margin: 0; }
.field-value {
  min-height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-1); background: var(--card);
  color: var(--ink); font-size: var(--fs-md); text-align: left; overflow: hidden;
}
.field-value.empty { color: var(--ink-4); }
button.field-value:hover { border-color: var(--line-strong); }
.field-value .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-value .label-chip { min-height: 22px; padding: 0 8px; font-size: var(--fs-sm); }
.reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--card);
  color: var(--ink-3); font-size: var(--fs-sm); font-weight: 800;
}
.reaction .icon { font-size: 14px; }
.reaction:hover { border-color: var(--line-strong); color: var(--ink); }
.reaction[aria-pressed="true"] { border-color: var(--chip-on-ring); background: var(--chip-on-bg); color: var(--badge-ink); }
.reaction.add { padding: 0 7px; border-style: dashed; }
.reaction-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.reaction-picks .reaction { justify-content: center; min-height: 40px; }
.reaction-picks .reaction .icon { font-size: 18px; }
.mention { padding: 0 4px; border-radius: 5px; background: var(--badge-bg); color: var(--badge-ink); font-weight: 700; white-space: nowrap; }
.ed-text .mention { cursor: default; }
.move-boards { display: grid; gap: 6px; }

/* Board fields page, admin */
.row.wrap { flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-bottom: 2px solid transparent; color: var(--ink-3); font-weight: 700; font-size: var(--fs-md);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--badge-ink); border-bottom-color: var(--violet); }
.tabs .icon { font-size: 15px; }
.table-wrap { overflow-x: auto; }
.grid-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.grid-table th {
  padding: 8px 10px; text-align: left; color: var(--ink-4);
  font-size: var(--fs-cap); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid-table td { padding: 10px; vertical-align: top; border-bottom: 1px solid var(--line); }
.grid-table tr:last-child td { border-bottom: 0; }
.grid-table .chip { margin: 0 4px 4px 0; }
.filters { display: grid; gap: 8px; margin-bottom: 14px; }
.filter-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-line .eyebrow { min-width: 72px; margin: 0; }
.chip-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--ink-2);
  font-size: var(--fs-md); font-weight: 700;
}
.chip-link:hover { color: var(--ink); border-color: var(--line-strong); }
.chip-link[aria-current="true"] { border-color: var(--chip-on-ring); background: var(--chip-on-bg); color: var(--badge-ink); }
.chip-link .icon { font-size: 13px; }
.journal-row { align-items: baseline; }
.journal-row time { width: 110px; flex: 0 0 auto; font-size: var(--fs-sm); }
.journal-row .grow { font-size: var(--fs-md); }
.weeks { display: grid; gap: 8px; margin-top: 14px; }
.week-row { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 10px; }
.week-row small { color: var(--ink-3); }
.meter { height: 10px; border-radius: var(--r-pill); background: var(--none-bg); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--violet); }
.meter .w-0 { width: 0%; } .meter .w-5 { width: 5%; } .meter .w-10 { width: 10%; }
.meter .w-15 { width: 15%; } .meter .w-20 { width: 20%; } .meter .w-25 { width: 25%; }
.meter .w-30 { width: 30%; } .meter .w-35 { width: 35%; } .meter .w-40 { width: 40%; }
.meter .w-45 { width: 45%; } .meter .w-50 { width: 50%; } .meter .w-55 { width: 55%; }
.meter .w-60 { width: 60%; } .meter .w-65 { width: 65%; } .meter .w-70 { width: 70%; }
.meter .w-75 { width: 75%; } .meter .w-80 { width: 80%; } .meter .w-85 { width: 85%; }
.meter .w-90 { width: 90%; } .meter .w-95 { width: 95%; } .meter .w-100 { width: 100%; }

/* Calendar */
.page.wide { max-width: 1600px; }
.cal-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-top h2 { margin: 0; min-width: 190px; text-align: center; font-size: var(--fs-xl); }
.cal-top .spacer { flex: 1; }
.month {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--r-4); overflow: hidden; background: var(--line); gap: 1px;
}
.month-dow { padding: 8px 10px; background: var(--card-2); color: var(--ink-4);
  font-size: var(--fs-cap); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.month-day { min-height: 118px; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--card); min-width: 0; }
.month-day.other { background: var(--card-2); }
.month-day.other .month-num { color: var(--ink-4); }
.month-day.today .month-num { background: var(--violet); color: var(--on-accent); }
.month-day.drop-over { box-shadow: inset 0 0 0 2px var(--violet); }
.month-num {
  align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; display: inline-grid; place-items: center;
  border-radius: var(--r-pill); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 800;
}
.month-card {
  display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 7px;
  border: 1px solid var(--line); border-left: 3px solid var(--tone, var(--violet)); border-radius: 6px;
  background: var(--card); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; text-align: left;
  cursor: pointer; min-width: 0;
}
.month-card:hover { border-color: var(--line-strong); }
.month-card .grow { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.month-card.done { color: var(--ink-4); text-decoration: line-through; }
.month-card.overdue { border-left-color: var(--bad); }
.month-card.dragging { opacity: 0.4; }
.month-more { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 800; padding: 0 4px; border: 0; background: none; text-align: left; }
.cal-note { margin-top: 10px; }
.month-wd { display: none; }
@media (max-width: 720px) {
  .month { grid-template-columns: minmax(0, 1fr); }
  .month-dow { display: none; }
  .month-day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .month-day.empty-day { display: none; }
  .month-day .month-card { flex: 1 1 100%; }
  .month-wd { display: inline; color: var(--ink-3); font-size: var(--fs-sm); font-weight: 700; }
  .cal-top h2 { min-width: 0; flex: 1; font-size: var(--fs-lg); }
  .journal-row time { width: auto; }
  .week-row { grid-template-columns: 96px 1fr 32px; }
}

/* Shortcuts */
.keys-dialog { width: min(560px, calc(100vw - 32px)); }
.keys-dialog .keys-body { display: grid; gap: 14px; padding: 22px; }
.keys-dialog h2 { margin: 0; font-size: var(--fs-xl); }
.keys-table { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; align-items: center; margin: 0; }
.keys-table dt { display: flex; gap: 4px; }
.keys-table dd { margin: 0; color: var(--ink-2); font-size: var(--fs-md); }
kbd.key {
  min-width: 26px; height: 26px; padding: 0 7px; display: inline-grid; place-items: center;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--card-2); color: var(--ink); font-family: var(--ff-mono); font-size: var(--fs-sm); font-weight: 700;
}
@media (max-width: 720px) {
  .topbar .hide-phone-strict, .board-head .search-link { display: none; }
  .topbar h1 { min-width: 0; flex: 1 1 auto; }
}
.detail:has(.detail-close) .detail-side { padding-top: 60px; }
