/* The Inbox (1.4): the #/inbox page, the phone top bar's tray button, the desktop home's + Inbox and the
   Help me sort sheet. Colours come from the tokens in app.css, so light, dark and app themes follow. */

/* ---------- top bar: Inbox in the nav (wider screens), a tray button on phones ---------- */
.nav .inbox-count { background: var(--lilac); }
.inbox-top { display: none; position: relative; color: var(--ink); text-decoration: none; }
.inbox-top.on { background: var(--surface); box-shadow: var(--shadow-sm); }
.inbox-badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--lilac); color: #fff;
  font-size: 10.5px; line-height: 18px; font-weight: 900; text-align: center; box-shadow: 0 0 0 2px var(--bg);
}
@media (max-width: 700px) {
  .topbar .inbox-top { display: inline-grid; place-items: center; }
}
/* Tablets: five nav items and the top-right buttons share the bar, so labels stay on one line and the
   Inbox shows its tray and count (its name is still read out). */
@media (min-width: 701px) and (max-width: 940px) {
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav a.inbox-tab > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- the page ---------- */
.inbox-page { max-width: 760px; margin: 0 auto; padding: 22px 18px calc(120px + var(--tabbar-h)); }
.inbox-head { margin-bottom: 14px; }
.inbox-head h1 { display: flex; align-items: center; gap: 10px; font-size: 30px; }
.inbox-head h1 svg { width: 26px; height: 26px; color: var(--lilac); }
.inbox-head p { margin: 4px 0 0; font-weight: 700; }

.inbox-capture {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 10px 10px 18px; border-radius: 24px; background: var(--surface);
  box-shadow: var(--shadow); border: 2px solid transparent; transition: border-color .15s, box-shadow .15s;
}
.inbox-capture:focus-within { border-color: color-mix(in srgb, var(--lilac) 60%, transparent); box-shadow: 0 10px 26px color-mix(in srgb, var(--lilac) 18%, transparent); }
.inbox-capture textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 40vh; padding: 10px 0; border: 0; background: none; resize: none; color: var(--ink);
  font: 700 18px/1.35 var(--f-body);
}
.inbox-capture textarea:focus { outline: 0; }
.inbox-capture textarea::placeholder { color: var(--faint); font-weight: 600; }
.ic-btns { display: flex; align-items: center; gap: 4px; flex: none; }
.ic-btns .btn { padding: 11px 20px; font-size: 15px; border-radius: 16px; }

.inbox-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 2px 8px; }
.ib-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: var(--soft); min-height: 44px; cursor: pointer; }
.ib-all input { width: 18px; height: 18px; accent-color: var(--lilac); }
.ib-count { flex: 1; color: var(--soft); font-weight: 800; font-size: 13px; }

.inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.inbox-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "check text actions" "check meta actions";
  align-items: center; gap: 0 10px; padding: 8px 10px 8px 6px;
  border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); border: 2px solid transparent; transition: border-color .15s, background .15s;
}
.inbox-item.selected { border-color: var(--lilac); background: color-mix(in srgb, var(--lilac-soft) 55%, var(--surface)); }
.ib-check, .ih-row { position: relative; cursor: pointer; }
.ib-check { grid-area: check; display: grid; place-items: center; width: 44px; height: 44px; }
.ib-check input, .ih-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ib-box {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line2); background: var(--surface);
  color: transparent; transition: background .15s, border-color .15s, color .15s;
}
.ib-box svg { width: 15px; height: 15px; stroke-width: 3; }
.ib-check input:checked + .ib-box, .ih-row input:checked + .ib-box { background: var(--lilac); border-color: var(--lilac); color: #fff; }
.ib-check input:focus-visible + .ib-box, .ih-row input:focus-visible + .ib-box { outline: 3px solid color-mix(in srgb, var(--lilac) 55%, transparent); outline-offset: 2px; }
.ib-text { grid-area: text; align-self: end; min-width: 0; margin: 0; font-weight: 800; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.ib-meta { grid-area: meta; align-self: start; display: flex; flex-wrap: wrap; gap: 2px 10px; min-width: 0; margin: 3px 0 0; color: var(--soft); font-size: 12px; font-weight: 800; }
.ib-due { display: inline-flex; align-items: center; gap: 4px; color: var(--soft); }
.ib-due svg { width: 12px; height: 12px; }
.ib-due.overdue { color: var(--red); }
.ib-due.soon { color: var(--pink-deep); }
.ib-actions { grid-area: actions; display: flex; align-items: center; gap: 2px; }
.ib-move { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; }
.ib-actions .icon-btn { color: var(--soft); }

.inbox-selbar {
  position: sticky; bottom: calc(14px + var(--tabbar-h) + var(--safe-bottom)); z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 12px 10px 18px; border-radius: 22px; background: var(--navbar); color: #fff; box-shadow: var(--shadow-lg);
}
.inbox-selbar .sb-count { flex: 1; font-weight: 900; }
.inbox-selbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.inbox-selbar .btn.primary { background: var(--lilac); color: #fff; }
.inbox-selbar .btn.ghost { color: #fff; }
.inbox-selbar .btn.ghost:hover { background: rgba(255, 255, 255, .12); }

/* Phones: the actions sit under the text, the Move button first and easy to reach. */
@media (max-width: 520px) {
  .inbox-page { padding-top: 14px; }
  .inbox-head h1 { font-size: 26px; }
  .inbox-capture { padding-left: 14px; border-radius: 20px; }
  .inbox-capture textarea { font-size: 17px; }
  .ic-btns .btn { padding: 11px 16px; }
  .inbox-item { grid-template-areas: "check text text" "check meta actions"; align-items: start; padding-top: 10px; padding-bottom: 6px; }
  .ib-check { margin-top: -6px; }
  .ib-text { align-self: start; padding-right: 4px; }
  .ib-meta { align-self: center; }
  .ib-actions { margin-right: -6px; }
  .ib-move { padding: 5px 10px; min-height: 34px; }
  .ib-added { display: none; }
}

/* ---------- desktop home: + Inbox in the sidebar ---------- */
.inbox-quick .home-label { margin: 0 0 6px; }
.iq-form {
  display: flex; gap: 6px; padding: 6px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); border: 2px solid transparent;
}
.iq-form:focus-within { border-color: color-mix(in srgb, var(--lilac) 60%, transparent); }
.iq-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 0; background: none; color: var(--ink); font: 700 14px var(--f-body); }
.iq-form input:focus { outline: 0; }
.iq-form .btn { flex: none; border-radius: 12px; }

/* ---------- Help me sort ---------- */
.inbox-help { max-width: 620px; }
.ih-busy { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--soft); padding: 18px 4px; }
.ih-dots { display: inline-flex; gap: 4px; }
.ih-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--lilac); animation: ih-bounce 1s infinite ease-in-out; }
.ih-dots i:nth-child(2) { animation-delay: .15s; }
.ih-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ih-bounce { 40% { transform: translateY(-5px); opacity: .6; } }
.ih-summary { font-weight: 800; margin: 0 0 4px; }
.ih-list { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 56vh; overflow-y: auto; }
.ih-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.ih-row:has(input:checked) { background: color-mix(in srgb, var(--lilac-soft) 55%, var(--surface)); }
.ih-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ih-text strong { font-weight: 800; overflow-wrap: anywhere; }
.ih-text small { display: inline-flex; align-items: center; gap: 4px; color: var(--soft); font-weight: 800; font-size: 12.5px; }
.ih-text small svg { width: 12px; height: 12px; flex: none; }
.ih-foot { display: flex; gap: 8px; margin-top: 12px; }
@media (prefers-reduced-motion: reduce) {
  .ih-dots i { animation: none; }
  .inbox-capture, .inbox-item, .ib-box { transition: none; }
}
.ib-pick-what { margin: 0 0 12px; font-weight: 800; color: var(--soft); overflow-wrap: anywhere; }
