/* Interests editor: the knowledge-feed setting for ongoing, active and archived interests.
   Same look as the capture page (colors and type from capture/panel.css). */

:root {
  --ground: #eef1ec;
  --paper: #ffffff;
  --ink: #161b22;
  --muted: #565f6b;
  --faint: #6b7280;
  --line: #d6d9d0;
  --line-dashed: #b9bdb3;
  --accent: #b8730f;
  --accent-ink: #7a4a10;
  --tint: #fbf1df;
  --tint-line: #e3c79a;
  --soft: #f7f8f5;
  --error: #a3261b;
  --ok: #2f6b3a;
  /* Same type as the Disco knowledge feed: Roboto for headings, Public Sans for text. */
  --head: 'Roboto', 'Google Sans', Arial, sans-serif;
  --sans: 'Public Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: 400 15px/1.45 var(--sans); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input { font: 400 16px var(--sans); color: var(--ink); }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* signed out / loading */
.center { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; gap: 14px; }
.ball-lg { width: 72px; height: 72px; filter: drop-shadow(0 4px 6px rgba(22,27,34,.2)); }
.ball-sm { width: 24px; height: 24px; }
.spin { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.brand { margin: 0; font: 600 26px var(--head); }
.google-btn { min-height: 44px; }
.email-form { display: flex; gap: 8px; width: 100%; max-width: 320px; }
.email-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: var(--paper); }

/* page */
.page { max-width: 720px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.top { display: flex; flex-direction: column; gap: 8px; }
.top-row { display: flex; align-items: center; gap: 8px; }
.title { margin: 2px 0 0; font: 700 30px/1.15 var(--head); letter-spacing: -.01em; }
.lede { margin: 0; font: 400 16px/1.5 var(--sans); color: var(--ink); max-width: 560px; }
.body-serif { margin: 0; font: 400 16px/1.5 var(--sans); }
.label { display: inline-flex; align-items: center; gap: 6px; font: 400 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hint { font-size: 13px; color: var(--faint); }
.small { font-size: 13px; color: var(--muted); }
.error { margin: 0; color: var(--error); font-size: 13px; }

.how { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.how summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.how dl { margin: 10px 0 2px; display: grid; gap: 4px 0; }
.how dt { display: flex; align-items: center; gap: 7px; font-weight: 600; margin-top: 6px; }
.how dd { margin: 0 0 0 15px; color: var(--muted); font-size: 14px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ongoing { background: var(--ink); }
.dot-active { background: var(--accent); }
.dot-archived { background: transparent; border: 1.5px solid var(--faint); }

/* Messages float at the top so they are seen wherever the reader is, and never cover a button they need. */
.status { position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); top: max(12px, env(safe-area-inset-top));
  width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 16px; border-radius: 10px;
  background: var(--tint); border: 1px solid var(--tint-line); box-shadow: 0 6px 18px rgba(22,27,34,.14);
  font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.status:empty { display: none; }
.status.is-error { background: #fbe9e7; border-color: #e6b3ad; color: var(--error); }

.empty { background: var(--tint); border: 1px solid var(--tint-line); border-radius: 12px; padding: 14px 16px; }

/* cards */
.ongoing-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.card-dashed { background: transparent; border-style: dashed; border-color: var(--line-dashed); }
.card-h { margin: 0; font: 600 17px var(--head); }

.ongoing-head { display: flex; align-items: center; gap: 8px; }
.ongoing-title { margin: 0; flex: 1; min-width: 0; font: 600 20px/1.25 var(--head); overflow-wrap: anywhere; }
.head-tools { display: flex; gap: 2px; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.rename { flex: 1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rename-input { flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 600 18px var(--head) !important; }

.confirm, .chip-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.confirm b, .chip-actions b { font-weight: 600; }

.group { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: 15px; cursor: pointer; text-align: left; }
.chip-active { background: var(--tint); border-color: var(--tint-line); color: var(--accent-ink); font-weight: 600; }
.chip-active[aria-expanded="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip-archived { background: transparent; border-style: dashed; border-color: var(--line-dashed); color: var(--muted); }
.chip-archived[aria-expanded="true"] { outline: 2px solid var(--faint); outline-offset: 1px; }
.chip-idea { border-style: dashed; color: var(--muted); font-size: 14px; min-height: 32px; padding: 4px 11px; }
.chip-idea::before { content: '+'; font-weight: 700; color: var(--accent); }
.chip-suggest { background: var(--soft); padding-right: 4px; cursor: default; }
.chip-suggest .mini { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.chip-suggest .mini:hover { background: var(--paper); color: var(--ink); }
.open-note { margin: 0; font-style: italic; }
.ideas { display: flex; flex-direction: column; gap: 6px; }

/* add boxes */
.combo { position: relative; display: flex; gap: 8px; }
.combo input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: var(--paper); }
.menu { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; list-style: none; margin: 0; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 22px rgba(22,27,34,.12); max-height: 300px; overflow: auto; }
.menu li { padding: 10px 12px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.menu li[aria-selected="true"], .menu li:hover { background: var(--tint); }
.menu .m-hint { color: var(--faint); font-size: 13px; text-align: right; }

.btn-dark { border: 0; border-radius: 8px; background: var(--ink); color: #fff; padding: 9px 16px; font-weight: 700; cursor: pointer; }
.btn-small { padding: 7px 12px; }
.btn-quiet { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 9px 14px; font-weight: 600; cursor: pointer; }
.btn-danger { border: 0; border-radius: 8px; background: var(--error); color: #fff; padding: 7px 12px; font-weight: 700; cursor: pointer; }
.link { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }
.btn-dark:disabled, .btn-quiet:disabled { opacity: .5; cursor: default; }

/* browse */
.browse { display: flex; flex-direction: column; gap: 6px; }
.area { border-top: 1px solid var(--line); padding-top: 6px; }
.area summary { cursor: pointer; font: 600 15px var(--head); padding: 6px 0; text-transform: capitalize; }
.area .chips { padding: 4px 0 10px; }

.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }

/* A card opened in place, under the chip or box used to pick it (Oct 27). */
.nest-slot { list-style: none; margin: 0; padding: 0; }
.nest-slot:empty { display: none; }
.area .nest-slot { padding: 2px 0 12px; }
.ongoing.nested { border-color: var(--tint-line); box-shadow: 0 4px 14px rgba(122,74,16,.10); }
.nest-done { display: none; justify-content: flex-end; }
.ongoing.nested .nest-done { display: flex; }
.chip-picked { background: var(--tint); border-color: var(--tint-line); color: var(--accent-ink); font-weight: 600; font-size: 14px; min-height: 32px; padding: 4px 11px; }
.chip-picked::before { content: '\2713'; font-weight: 700; }
.chip-picked[aria-expanded="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.list-h { margin: 8px 0 0; font: 600 18px var(--head); }

/* Areas hold everything (Oct 27, later): area > your interests in it > their specifics. */
.areas { display: flex; flex-direction: column; gap: 10px; }
.area { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.area[open] { padding-bottom: 14px; }
.area > summary { cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 13px 0; font: 600 17px var(--head); text-transform: capitalize; list-style: none; }
.area > summary::-webkit-details-marker { display: none; }
/* Open/closed triangle on the left, like "How this works": points right when closed, down when open. */
.area > summary::before { content: ''; flex: none; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--ink); transition: transform .15s ease; }
.area[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .area > summary::before { transition: none; } }
.area-name { flex: 1; }
.area-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--tint); border: 1px solid var(--tint-line); color: var(--accent-ink); font: 700 12px/22px var(--sans); text-align: center; }
.area-count:empty { display: none; }
.area-cards { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.area-cards:empty { display: none; }
.area-more { display: flex; flex-direction: column; gap: 6px; }
.area .ongoing { background: var(--soft); padding: 12px 14px; gap: 10px; }
.area .ongoing.nested { background: var(--paper); }
.area .ongoing-title { font-size: 18px; }

/* A closed card: name and its specifics, read-only; tap to open. */
.ongoing:not(.nested) { cursor: pointer; }
.ongoing:not(.nested):hover { border-color: var(--tint-line); }
.ongoing:not(.nested):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ongoing:not(.nested) .head-tools,
.ongoing:not(.nested) .confirm,
.ongoing:not(.nested) .chip-actions,
.ongoing:not(.nested) .combo-active,
.ongoing:not(.nested) .ideas,
.ongoing:not(.nested) .group-suggested,
.ongoing:not(.nested) .nest-done { display: none !important; }
.ongoing:not(.nested) .chip { pointer-events: none; min-height: 28px; padding: 3px 10px; font-size: 13.5px; }
.ongoing:not(.nested) .label { display: none; }
.ongoing:not(.nested) .group { gap: 6px; }
.ongoing:not(.nested) .ongoing-head::after { content: 'Edit'; font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }

/* "Which area does this belong in?" under the add bar (Oct 27). */
.area-confirm { background: var(--tint); border: 1px solid var(--tint-line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.area-confirm .ask { margin: 0; font: 600 15px var(--sans); color: var(--accent-ink); }
.ask-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ask-row select { flex: 1; min-width: 180px; font: 400 16px var(--sans); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }

/* Archived = mastered: a green check on the pill (Oct 27). */
.chip-archived::before { content: ''; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ok)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.3l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }

/* Remove an area / add it back (Oct 27). Removed areas sit greyed at the end. */
.area-hide { flex: none; border: 0; background: none; padding: 4px 2px; font: 600 13px var(--sans); color: var(--faint); text-transform: none; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.area-hide:hover { color: var(--ink); }
.area.is-removed { background: transparent; border-style: dashed; border-color: var(--line-dashed); }
.area.is-removed > summary { cursor: default; color: var(--faint); }
.area.is-removed > summary::before { opacity: .35; }
.area.is-removed .area-count { opacity: .6; }
.area.is-removed .area-hide { color: var(--accent-ink); }
.removed-h { margin: 14px 0 0; font: 400 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.area-hide.is-x { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; text-decoration: none; margin-right: -6px; }
.area-hide.is-x:hover { background: var(--soft); }
.area-more-btn { align-self: flex-start; margin-top: 2px; font-size: 14px; text-decoration: none; }
.area-more-btn:hover { text-decoration: underline; }
.area-confirm-bar { margin-bottom: 12px; }

/* Chip actions (Oct 27): mastered / bring back / remove icons on each chip, only in an open card. */
.chip-active, .chip-archived { cursor: default; }
.ongoing.nested .chip-active, .ongoing.nested .chip-archived { padding-right: 4px; gap: 2px; }
.chip-name { padding-right: 4px; }
.chip-tool { width: 30px; height: 30px; flex: none; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .75; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.chip-tool:hover, .chip-tool:focus-visible { opacity: 1; background: rgba(255,255,255,.8); }
.chip-tool.tool-archive { color: var(--ok); opacity: 1; }
.ongoing:not(.nested) .chip-tool { display: none; }
.status .undo { margin-left: 6px; border: 0; background: none; padding: 0; font: 700 14px var(--sans); color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Help text on hover (Oct 27). */
.tip-float { position: fixed; z-index: 20; max-width: 260px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: #fff;
  font: 500 13px/1.4 var(--sans); box-shadow: 0 6px 18px rgba(22,27,34,.25); pointer-events: none; }
.top-link { margin-left: auto; font: 600 14px var(--sans); color: var(--accent-ink); text-decoration: none; }
.top-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Oct 29: areas are headings; "Explore all of <Area>" is the broad choice, set apart from the categories. */
.chip-explore { border-style: solid; border-color: var(--tint-line); color: var(--accent-ink); font-weight: 600; }
.chip-explore::before { content: '\2192'; }
.explore-card .group > .label, .explore-card .combo-active { display: none !important; }
.explore-card .open-note { font-style: normal; }

/* Reading preferences (Oct 29) */
.prefs { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.prefs-title { margin: 0; font: 600 17px var(--head); }
.prefs-fields { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.pref { display: flex; align-items: center; gap: 10px; }
.pref-label { font-size: 14px; color: var(--muted); }
.pref select { font: 500 15px var(--sans); color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-height: 38px; }
.pref select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip { min-width: 46px; min-height: 36px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font: 600 13px var(--sans); color: var(--muted); cursor: pointer; padding: 0 10px; }
.day-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.subs { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.subs .hint { margin: 0; }
.prefs .hint { margin: 0; }

/* Page tabs (Nov 2): Disco feed / Interests, pinned to the top like the v1 feed's tab bar. Hidden while signed out. */
.page-tabs { position: sticky; top: 0; z-index: 30; background: var(--ground); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top); }
.page-tabs-inner { max-width: 720px; margin: 0 auto; display: flex; gap: 24px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
/* Nov 4 (CJ): only the tab's words are underlined, not the disco ball; a "Beta" label follows "Disco feed". */
.page-tab { display: inline-flex; align-items: center; gap: 8px; padding: 0 2px; margin-bottom: -1px; align-self: stretch;
  font: 600 16px var(--sans); color: var(--muted); text-decoration: none; }
.page-tab-label { align-self: stretch; display: flex; align-items: center; padding: 13px 0 11px; border-bottom: 3px solid transparent; }
.page-tab:hover { color: var(--ink); }
.page-tab[aria-current="page"] { color: var(--ink); }
.page-tab[aria-current="page"] .page-tab-label { border-bottom-color: var(--accent); }
.page-tab .ball-sm { width: 24px; height: 24px; }
.beta { font: 500 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink);
  border: 1px solid var(--tint-line, rgba(226,166,59,.4)); border-radius: 4px; padding: 1px 5px; margin-left: -2px; }
body:has(#view-signin:not([hidden])) .page-tabs, body:has(#view-wait:not([hidden])) .page-tabs { display: none; }

/* "Keep, pause or remove?" (Nov 3) and paused interests */
.checks { display: flex; flex-direction: column; gap: 10px; }
.check { border: 1px solid var(--tint-line); background: var(--tint); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.check p { margin: 0; font-size: 15px; line-height: 1.45; }
.check-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.paused-tag { display: inline-block; font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border: 1px dashed var(--line-dashed); border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.resume-link { font-size: 13px; vertical-align: middle; }
.ongoing.is-paused { opacity: .7; }
.chip-paused { opacity: .6; border-style: dashed; }

/* Daily email switch (Nov 4) */
.email-pref { display: flex; align-items: flex-start; gap: 10px; margin: 28px 0 0; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--paper); cursor: pointer; }
.email-pref input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
