/* TEAM module: team roles (members page, book page), reader fixes queue (/book/<id>/corrections, /corrections).
   Theme variables only (www/css/nb.css), sharp radii. */

.tm-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- role chips */
.nb-chip.tm-role { font-size: 10.5px; padding: 1px 8px; }
.nb-chip.tm-role-owner { background: color-mix(in oklab, var(--translator) 18%, transparent); color: var(--translator); }
.nb-chip.tm-role-lead { background: color-mix(in oklab, var(--success) 18%, transparent); color: var(--success); }
.nb-chip.tm-role-translator { background: color-mix(in oklab, var(--link) 16%, transparent); color: var(--link); }
.nb-chip.tm-role-editor { background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); }
.nb-chip.tm-role-proofreader { background: color-mix(in oklab, var(--warning) 16%, transparent); color: var(--warning); }
.nb-chip.tm-role-beta_reader { background: color-mix(in oklab, var(--rating-text) 16%, transparent); color: var(--rating-text); }
.nb-chip.tm-role-qc { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); }
.nb-chip.tm-role-typesetter { background: var(--secondary); color: var(--muted-foreground); }
.tm-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tm-chips:empty { display: none; }

/* ---------------------------------------------------------------- members page */
.tm-member-body { min-width: 0; }
.tm-roles-edit { margin-top: 6px; }
.tm-roles-edit > summary {
	display: inline-flex; align-items: center; gap: 5px; cursor: pointer; list-style: none;
	font-size: 12px; font-weight: 600; color: var(--muted-foreground); padding: 2px 6px; margin-left: -6px; border-radius: var(--radius-sm);
}
.tm-roles-edit > summary::-webkit-details-marker { display: none; }
.tm-roles-edit > summary:hover { color: var(--foreground); background: var(--muted); }
.tm-roles-edit[open] > summary { color: var(--foreground); }
.tm-roles-edit[open] { padding: 10px 12px; margin: 8px 0 2px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.tm-roles-edit .help-block { margin: 6px 0 0; font-size: 12px; }
.tm-roles-edit.is-saving { opacity: .6; pointer-events: none; }

.tm-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.tm-pick { display: inline-flex; margin: 0; cursor: pointer; }
.tm-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tm-pick span {
	display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill);
	font-size: 12px; font-weight: 600; color: var(--muted-foreground); background: transparent; transition: background .15s, color .15s, border-color .15s;
}
.tm-pick span::before { content: "+"; font-weight: 700; opacity: .7; }
.tm-pick:hover span { color: var(--foreground); border-color: var(--input); }
.tm-pick input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.tm-pick input:checked + span::before { content: "✓"; opacity: 1; }
.tm-pick input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }

.tm-invite-form { margin: 0; }
.tm-invite-roles { border: 0; margin: 10px 0 0; padding: 0; min-width: 0; }
.tm-invite-roles legend { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); margin: 0 0 2px; padding: 0; border: 0; width: auto; line-height: 1.4; }
.tm-invite-roles .tm-picks { margin-bottom: 0; }
.tm-invite-box { padding: 10px 12px; margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--muted); }
.tm-invite-box p { margin: 0 0 8px; }
.lg-invited small { color: var(--muted-foreground); font-size: 11px; }

.tm-settings { display: grid; gap: 10px; margin: 0; }
.tm-settings h2 { margin-bottom: 0 !important; }
.tm-settings .nb-btn { justify-self: start; }
.tm-switch { display: flex; gap: 10px; align-items: flex-start; margin: 0; cursor: pointer; }
.tm-switch input { margin-top: 3px; flex: none; }
.tm-switch span { display: grid; gap: 2px; min-width: 0; }
.tm-switch b { font-size: 13.5px; font-weight: 600; }
.tm-switch small { font-size: 12.5px; }

.tm-roles-explainer { margin-top: 30px; }
.tm-roles-explainer h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin: 0 0 6px; }
.tm-roles-explainer > p { margin: 0 0 14px; font-size: 13.5px; }
.tm-role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.tm-role-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); min-width: 0; }
.tm-role-item p { margin: 6px 0 8px; font-size: 13px; color: var(--muted-foreground); line-height: 1.5; }
.tm-perms { display: flex; flex-wrap: wrap; gap: 4px; }
.tm-perm { font-size: 11px; padding: 1px 7px; border-radius: var(--radius-sm); background: var(--secondary); color: var(--foreground); white-space: nowrap; }

/* tab counter (book tabs) */
.tm-tab-count {
	display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-sm);
	background: color-mix(in oklab, var(--warning) 22%, transparent); color: var(--warning); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- reader bar (chapter reader, team only) */
.tm-reader-bar {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin: 0 0 16px;
	border: 1px solid color-mix(in oklab, var(--warning) 40%, var(--border)); border-radius: var(--radius);
	background: color-mix(in oklab, var(--warning) 9%, transparent); font-size: 13px;
}
.tm-reader-bar span { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- fixes queue */
.tm-page { max-width: 1040px; }
.tm-head h1 { margin: 0 0 6px; }
.tm-head > p { margin: 0 0 22px; max-width: 70ch; }
.tm-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.tm-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-seg .nb-chip { padding: 4px 11px; font-size: 12.5px; }
.tm-seg .nb-chip b { font-weight: 700; opacity: .75; font-variant-numeric: tabular-nums; }
.tm-chapter-filter { display: flex; gap: 6px; align-items: center; margin: 0; }
.tm-chapter-filter select { max-width: min(320px, 70vw); margin: 0; }
.tm-lead { font-size: 13px; margin: 0 0 18px; max-width: 80ch; }

.tm-list { display: grid; gap: 14px; }
.nb-card.tm-fix { padding: 16px 18px; margin: 0; min-width: 0; }
.nb-card.tm-fix + .nb-card.tm-fix { margin-top: 0; }
.tm-fix.is-open { border-left: 3px solid var(--warning); }
.tm-fix.is-accepted { border-left: 3px solid var(--success); }
.tm-fix.is-rejected { border-left: 3px solid var(--border); }
.tm-fix-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; min-width: 0; }
.tm-fix-chap { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--foreground); min-width: 0; overflow-wrap: anywhere; }
.tm-fix-seg { font-size: 12px; }
.tm-fix-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin: 0 0 12px; }
.tm-fix-who .nb-avatar { width: 24px; height: 24px; font-size: 11px; }
.tm-fix-who a.user { font-weight: 600; color: var(--foreground); }
.tm-fix-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .tm-fix-grid { grid-template-columns: minmax(0, 1fr); } }
.tm-lbl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); margin: 0 0 5px; }
.tm-fix-text {
	padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted);
	font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; min-width: 0;
}
.tm-fix-text.is-ins { background: color-mix(in oklab, var(--success) 8%, transparent); border-color: color-mix(in oklab, var(--success) 30%, var(--border)); }
mark.tm-del { background: color-mix(in oklab, var(--destructive) 18%, transparent); color: inherit; padding: 0 1px; border-radius: var(--radius-sm); text-decoration: line-through; text-decoration-color: color-mix(in oklab, var(--destructive) 60%, transparent); }
.tm-fix-meta { font-size: 12px; margin-top: 4px; }
.tm-fix-note { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; margin: 8px 0 0; color: var(--muted-foreground); overflow-wrap: anywhere; }
.tm-fix-note svg { flex: none; margin-top: 3px; }
.tm-orig { margin: 12px 0 0; font-size: 13px; }
.tm-orig summary { cursor: pointer; color: var(--muted-foreground); font-weight: 600; }
.tm-orig > div { margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--border); font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }

.tm-fix-form { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--border); display: grid; gap: 8px; }
.tm-fix-form textarea { width: 100%; box-sizing: border-box; margin: 0; font-size: 15px; min-height: 90px; }
.tm-fix-form textarea[disabled] { opacity: .55; }
.tm-modes { display: flex; flex-wrap: wrap; gap: 6px 16px; border: 0; margin: 0; padding: 0; min-width: 0; }
.tm-modes label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; cursor: pointer; }
.tm-modes input { margin: 0; }
.tm-reply { width: 100%; box-sizing: border-box; margin: 0; }
.tm-fix-actions { gap: 8px; }
.tm-fix.is-busy { opacity: .6; pointer-events: none; }
.tm-fix-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 13px; color: var(--muted-foreground); }
.tm-fix-foot form { margin: 0; }
.tm-fix-reply { color: var(--foreground); font-style: italic; overflow-wrap: anywhere; }

/* /corrections */
.tm-mine section + section, .tm-queues { margin-bottom: 28px; }
.tm-mine h2 { font-size: 18px; margin: 0 0 12px; }
.tm-queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.nb-card.tm-queue { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; margin: 0; color: var(--foreground); min-width: 0; }
.nb-card.tm-queue + .nb-card.tm-queue { margin-top: 0; }
.nb-card.tm-queue:hover { text-decoration: none; border-color: var(--input); }
.tm-queue-title { font-weight: 600; overflow-wrap: anywhere; }
.tm-queue .nb-chip { align-self: flex-start; }

/* legacy v3.1.css styles bare header/footer elements (site chrome); reset them inside module blocks */
header.tm-fix-head, header.tm-head { height: auto; position: static; }
header.tm-head { margin: 0; }
footer.tm-fix-foot { border: 0; padding: 0; margin: 12px 0 0; }
