/* Saga-specific styles layered over the shared admin.css design system.
   Conventions carried from the sibling apps: editable fields get the
   warning-yellow tint; read-only presentation stays gray. */

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.list-head h1 { margin: 0; }

.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: 0.85rem; text-decoration: none; border: 1px solid var(--line); }
.filter-chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: color-mix(in srgb, var(--chip) 14%, #fff); color: color-mix(in srgb, var(--chip) 80%, #000); border: 1px solid color-mix(in srgb, var(--chip) 45%, #fff); }

.empty { color: var(--muted); }
.danger { color: var(--danger); }

.warn-tag { display: inline-block; font-size: 0.7rem; padding: 1px 8px; border-radius: 999px; background: var(--err-bg); color: var(--err-ink); border: 1px solid #e5a49c; margin-left: 4px; }

.count-pill { display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; vertical-align: 3px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.8rem; font-weight: 700; }

/* Forms — editable affordance: warning-yellow fill on inputs the user can change */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; margin: 0; font-weight: 600; }
.fld.wide { grid-column: 1 / -1; }
.fld input, .fld select, .fld textarea, .row-form input, .row-form select {
  background: #fff9e0; border: 1px solid #d9b93f; border-radius: 8px; color: var(--ink);
  padding: 10px; font-size: 1rem; width: 100%; font-weight: 400;
}
.fld .hint { color: var(--muted); font-style: normal; font-size: 0.75rem; font-weight: 400; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 12px; }

.row-form { display: flex; gap: 6px; align-items: center; }
.row-form.wrap { flex-wrap: wrap; }
.row-form input, .row-form select { width: auto; flex: 1 1 120px; padding: 8px; font-size: 0.9rem; }

.add-sub { margin-top: 8px; }
.add-sub summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; padding: 4px 0; }
.add-sub form { margin-top: 8px; }

/* ── Mobile nav: hamburger below 700px, unchanged desktop above ───────────── */
.menu-btn { display: none; background: none; border: 0; color: #cfd6dd; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
@media (max-width: 700px) {
  .menu-btn { display: block; }
  .topnav .links { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0 8px; }
  .topnav.open .links { display: flex; }
  .topnav .links a, .topnav .links .linklike { display: block; padding: 10px 4px; font-size: 1.05rem; border-top: 1px solid #232a33; width: 100%; text-align: left; }
}

/* ── Floating bug / feature reporter (carbon-admin pattern) ───────────────── */
#reportfab {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: #dc2626; color: #fff; font-size: 1.45rem; font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
#reportbox {
  position: fixed; right: 16px; bottom: 16px; z-index: 61;
  width: 340px; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25); padding: 14px;
}
.report-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.report-tabs { display: flex; gap: 6px; }
.report-tab { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; cursor: pointer; }
.report-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#report-close { background: none; border: 0; font-size: 1.2rem; color: var(--muted); cursor: pointer; }
#report-text { width: 100%; box-sizing: border-box; margin: 6px 0; }
.report-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ── Issues page ──────────────────────────────────────────────────────────── */
.issue-card { padding: 12px 14px; }
.issue-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.issue-actions { margin-top: 8px; align-items: center; }

/* ── Projects / books ─────────────────────────────────────────────────────── */
.project-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.project-row:hover { border-color: var(--accent); }
.p-title { font-weight: 700; }
.next-step { border-left: 4px solid var(--accent); }

.chapter-list { display: flex; flex-direction: column; }
.chapter-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.chapter-row:last-child { border-bottom: 0; }
.chapter-row:hover .ch-title { color: var(--accent); }
.ch-num { flex: 0 0 26px; font-weight: 800; color: var(--muted); }
.ch-title { flex: 1; font-weight: 600; }

/* ── Interview ────────────────────────────────────────────────────────────── */
.question { margin: 16px 0 20px; }
.q-text { font-weight: 700; margin: 0 0 2px; }
.opt { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; font-weight: 400; cursor: pointer; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.opt:hover { border-color: var(--accent); }
/* Base admin.css widens every non-checkbox input to 100%; radios must stay natural size. */
.opt input[type=radio] { display: inline-block; width: auto; flex: 0 0 auto; margin: 3px 0 0; }
.opt span { flex: 1; }
.opt:has(input:checked) { border-color: var(--accent); background: #f0f6ff; }
.other-opt { display: inline-flex; margin-bottom: 4px; }
.other-text { margin-top: 2px; }

/* ── Jobs ─────────────────────────────────────────────────────────────────── */
.job-banner { border-left: 4px solid var(--accent); }
.job-head { display: flex; align-items: center; gap: 10px; }
.job-log { white-space: pre-wrap; margin: 8px 0 0; max-height: 90px; overflow: auto; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Outline ──────────────────────────────────────────────────────────────── */
.outline-ch input[type=text] { width: 100%; font-weight: 700; margin-bottom: 6px; }
.outline-ch textarea { width: 100%; }
.outline-ch input, .outline-ch textarea { background: #fff9e0; border: 1px solid #d9b93f; border-radius: 8px; padding: 8px; font: inherit; }
.outline-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.outline-head .ow { width: 90px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; margin-top: 0; }

/* ── Chapter revision ─────────────────────────────────────────────────────── */
.chapter-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .chapter-layout { grid-template-columns: 1fr; } }
.prose { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; font-family: Georgia, 'Times New Roman', serif; font-size: 1.05rem; line-height: 1.7; }
.prose .para { margin: 0 0 1em; cursor: pointer; border-radius: 6px; padding: 2px 6px; margin-left: -6px; }
.prose .para:hover { background: #f0f6ff; }
.prose .para.sel { background: #fff9e0; outline: 1px solid #d9b93f; }
.prose .para.linemode .sent { cursor: pointer; border-bottom: 1px dashed #d9b93f; }
.prose .para.linemode .sent:hover { background: #ffe9a8; }
.prose .sent.sel { background: #ffe9a8; }
.cmark { color: var(--danger); font-weight: 700; margin-left: 4px; }
.side-col .card { margin-top: 0; }
.v-current td { background: #f0f6ff; }
.comment { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.comment.resolved { opacity: 0.55; }

/* ── Publish page ─────────────────────────────────────────────────────────── */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 5px 0; color: var(--muted); }
.checklist li.done { color: var(--ok-ink); font-weight: 600; }
.cover-grid { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.cover-card { width: 150px; text-align: center; }
.cover-card img { width: 150px; aspect-ratio: 5/8; object-fit: cover; border-radius: 6px; border: 2px solid var(--line); display: block; margin-bottom: 6px; }
.cover-card.active img { border-color: var(--ok-ink); }
