/* Tamraght Forum – community layer: rules, strikes, ranks, badges, member profiles, messages.
   Uses the tokens from forum.css so day and night modes follow automatically. */

:root {
	--cm-gold-bg: #F3E2AE; --cm-gold-ink: #6B4C05;
	--cm-fresh: #2F6B4A;
	--cm-team-bg: #E6EFEE; --cm-team-line: #BFD5D3;
	--cm-warn-bg: #F5EAD2; --cm-warn-ink: #7A5410;
}
body.tmf-night {
	--cm-gold-bg: #4A3B12; --cm-gold-ink: #F2D58A;
	--cm-fresh: #8FD3A8;
	--cm-team-bg: #1F4352; --cm-team-line: #3A6676;
	--cm-warn-bg: #3A2F14; --cm-warn-ink: #F2D58A;
}

.tmf-cm-ico { width: 1.15em; height: 1.15em; }

/* ---------- Rank and achievement badges ---------- */
.tmf-badge--contributor { background: var(--cm-gold-bg); color: var(--cm-gold-ink); }
.tmf-badge--regular { background: var(--sand-2); color: var(--ink); }
.tmf-badge--fresh { background: transparent; color: var(--cm-fresh); box-shadow: inset 0 0 0 1.5px currentColor; }
.tmf-badge--ach { padding: 3px 6px; background: var(--sand-2); color: var(--accent); }
.tmf-badge--ach .tmf-cm-ico { width: 13px; height: 13px; }
body.tmf-night .tmf-badge--warn { background: var(--cm-warn-bg); color: var(--cm-warn-ink); }
body.tmf-night .tmf-badge--ok { background: #183A2C; color: #BFE3CB; }
.tmf-post__who .tmf-badge { margin-left: 0; margin-bottom: 0; }

/* ---------- Rules (join form, notice, dashboard) ---------- */
.tmf-cm-rules { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 18px 14px; margin: 6px 0 4px; }
.tmf-cm-rules--scroll .tmf-cm-rules__list { max-height: 260px; overflow-y: auto; padding-right: 6px; overscroll-behavior: contain; }
.tmf-cm-rules__title { font-size: 1.05rem; margin: 0 0 10px; }
.tmf-cm-rules__list { margin: 0 0 14px; padding-left: 1.4em; display: grid; gap: 8px; }
.tmf-cm-rules__list li { padding-left: 2px; line-height: 1.45; }
.tmf-cm-rules__list li::marker { color: var(--accent); font-weight: 700; }
.tmf-cm-rules__list strong { display: block; color: var(--ink); }
.tmf-cm-rules__list span { color: var(--muted); font-size: .92rem; }
.tmf-cm-policy__lead { margin: 0 0 8px; font-weight: 600; }
.tmf-cm-policy__steps { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tmf-cm-step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.tmf-cm-step__n { flex-shrink: 0; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: .85rem; background: var(--cm-warn-bg); color: var(--cm-warn-ink); }
.tmf-cm-step--3 .tmf-cm-step__n { background: var(--accent); color: var(--surface); }
.tmf-cm-step__txt { display: grid; gap: 2px; font-size: .9rem; line-height: 1.3; }
.tmf-cm-step__txt span { color: var(--muted); }
.tmf-cm-accept { display: block; }
.tmf-cm-accept summary { cursor: pointer; }
.tmf-cm-accept .tmf-cm-rules { margin: 12px 0; font-weight: 400; color: var(--ink); background: var(--surface); }

/* ---------- Ban notice ---------- */
.tmf-cm-ban p { margin: 6px 0 0; font-weight: 400; }
.tmf-cm-ban a { color: inherit; font-weight: 600; }
body.tmf-night .tmf-notice--warn { background: var(--cm-warn-bg); border-color: #6B5520; color: var(--cm-warn-ink); }

/* ---------- Member profile ---------- */
.tmf-cm-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.tmf-cm-head__main { flex: 1 1 260px; min-width: 0; }
.tmf-cm-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 6px; overflow-wrap: anywhere; }
.tmf-cm-head__meta { margin: 6px 0 0; font-size: .92rem; }
.tmf-cm-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tmf-cm-head__actions .tmf-report { margin-left: 0; }
.tmf-cm-bio { max-width: 68ch; margin: 0 0 18px; font-size: 1.02rem; line-height: 1.55; overflow-wrap: anywhere; }
.tmf-cm-stats { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.tmf-cm-stats li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 2px; }
.tmf-cm-stats strong { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--ink); }
.tmf-cm-stats span { color: var(--muted); font-size: .85rem; }
.tmf-cm-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.tmf-cm-history li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.tmf-cm-modpanel { margin-top: 4px; border-style: dashed; }
.tmf-cm-modpanel .tmf-cm-cols { margin-bottom: 0; }
.tmf-cm-modpanel .tmf-h3:first-child { margin-top: .4em; }
.tmf-cm-inline { display: grid; gap: 8px; margin-bottom: 4px; }
.tmf-cm-inline label { font-weight: 600; font-size: .92rem; }
.tmf-cm-inline .tmf-btn { justify-self: start; }

/* Achievements */
.tmf-cm-achs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.tmf-cm-ach { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.tmf-cm-ach__ico { flex-shrink: 0; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--cm-gold-bg); color: var(--cm-gold-ink); }
.tmf-cm-ach__ico .tmf-cm-ico { width: 22px; height: 22px; }
.tmf-cm-ach__txt { display: grid; gap: 2px; min-width: 0; line-height: 1.3; }
.tmf-cm-ach__txt strong { color: var(--ink); }
.tmf-cm-ach__txt > span { font-size: .86rem; color: var(--muted); }
.tmf-cm-ach__date { font-size: .78rem !important; }
.tmf-cm-ach.is-locked { background: transparent; border-style: dashed; }
.tmf-cm-ach.is-locked .tmf-cm-ach__ico { background: var(--sand-2); color: var(--muted); }
.tmf-cm-ach.is-locked strong { color: var(--muted); }
.tmf-cm-ach.is-hidden { opacity: .7; }

/* ---------- Dashboard: points & badges ---------- */
.tmf-cm-dash { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; margin-bottom: 22px; }
.tmf-cm-rankcard__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.tmf-cm-rankcard__top h2 { font-size: 1.6rem; font-weight: 800; margin: 2px 0 0; }
.tmf-cm-rankcard__pts { text-align: right; display: grid; }
.tmf-cm-rankcard__pts strong { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--accent); }
.tmf-cm-rankcard__pts span { color: var(--muted); font-size: .85rem; }
.tmf-cm-progress { height: 10px; border-radius: var(--r-pill); background: var(--sand-2); overflow: hidden; margin-bottom: 8px; }
.tmf-cm-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ocean), var(--accent)); }
.tmf-cm-rankcard__what { margin: 14px 0 0; font-size: .92rem; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.tmf-cm-points td:nth-child(n+2), .tmf-cm-points th:nth-child(n+2) { text-align: right; white-space: nowrap; }
.tmf-cm-points td:first-child { min-width: 9em; }
.tmf-cm-privacy fieldset { border: 0; padding: 0; margin: 0 0 18px; display: grid; gap: 12px; }
.tmf-cm-privacy legend { font-weight: 700; font-size: 1.02rem; margin-bottom: 8px; padding: 0; }
.tmf-cm-toggles .tmf-check > span { display: grid; gap: 1px; }
.tmf-cm-toggles .tmf-check .tmf-muted { font-size: .86rem; }
.tmf-cm-picklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tmf-cm-picklist li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 0; border-top: 1px solid var(--line); }
.tmf-cm-picklist li:first-child { border-top: 0; }
.tmf-cm-picklist__name { flex: 1 1 180px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.tmf-cm-picklist__name .tmf-cm-ico { color: var(--accent); }
.tmf-cm-picklist .tmf-check { align-items: center; }
.tmf-cm-picklist .tmf-check input { margin-top: 0; }
.tmf-cm-record { margin-top: 20px; }
.tmf-cm-record .tmf-fold { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r-md); }
.tmf-cm-record .tmf-fold summary { padding: 12px 16px; font-weight: 600; }
.tmf-cm-record .tmf-fold .tmf-cm-rules { margin: 0 12px 12px; }
.tmf-cm-dash + .tmf-card, .tmf-cm-privacy + .tmf-panel { margin-top: 0; }
.tmf-cm-privacy + .tmf-panel { margin-bottom: 0; }

/* Strike record */
.tmf-cm-strikelist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.tmf-cm-strikelist li { padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--bg); }
.tmf-cm-strikelist li.is-removed { border-left-color: var(--line); opacity: .75; }
.tmf-cm-strikelist p { margin: 6px 0 0; overflow-wrap: anywhere; }
.tmf-cm-strikelist__top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tmf-cm-strikelist__top .tmf-badge { margin: 0; }
.tmf-cm-banbadge { display: inline-flex; margin: 0 0 10px; text-transform: none; letter-spacing: 0; font-size: .84rem; padding: 6px 12px; border-radius: var(--r-sm); }
.tmf-cm-banlist { list-style: none; margin: 0 0 8px; padding: 0; }
.tmf-cm-banlist li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.tmf-cm-banlist li:first-child { border-top: 0; }
.tmf-cm-leaders { margin-bottom: 22px; }
.tmf-cm-leaderlist { list-style: none; margin: 0; padding: 0; counter-reset: tmflb; }
.tmf-cm-leaderlist li { counter-increment: tmflb; display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.tmf-cm-leaderlist li::before { content: counter(tmflb); flex-shrink: 0; width: 1.3em; color: var(--muted); font-weight: 700; }
.tmf-cm-leaderlist li:first-child { border-top: 0; }
.tmf-cm-leaderlist li > .tmf-cell-user { flex: 1; min-width: 0; }
.tmf-cm-leaderlist .tmf-cell-user > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.tmf-cm-leaderlist .tmf-cell-user .tmf-badge { margin: 0; }
.tmf-cm-leaderlist li > strong { flex-shrink: 0; white-space: nowrap; font-size: .9rem; }
.tmf-cm-setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; margin-bottom: 12px; }
.tmf-cm-settings form { padding: 0 22px 22px; }

/* Strike popover (reuses the report popover) */
.tmf-cm-strike summary { color: var(--accent); }
.tmf-cm-strike .tmf-report__form { left: auto; right: 0; }
.tmf-cm-strike__what { margin: 0; font-size: .9rem; }
.tmf-row-actions .tmf-cm-strike, .tmf-queue__item .tmf-cm-strike { margin-left: 0; }

/* ---------- Messages ---------- */
.tmf-cm-thread { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 12px; }
.tmf-cm-msg { max-width: min(640px, 92%); padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.tmf-cm-msg--team { background: var(--cm-team-bg); border-color: var(--cm-team-line); justify-self: start; border-bottom-left-radius: 4px; }
.tmf-cm-msg--member { justify-self: end; background: var(--bg); border-bottom-right-radius: 4px; }
.tmf-cm-msg__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .88rem; margin-bottom: 6px; }
.tmf-cm-msg__head time { margin-left: auto; font-size: .8rem; }
.tmf-cm-msg__body { line-height: 1.55; overflow-wrap: anywhere; }
.tmf-cm-chip { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: var(--r-pill); background: var(--sand-2); color: var(--ink); }
.tmf-cm-chip--strike { background: var(--accent); color: var(--surface); }
body.tmf-night .tmf-cm-chip--strike { color: #0E1B26; }
.tmf-cm-reply { margin-top: 8px; display: grid; gap: 8px; }
.tmf-cm-reply > label { font-weight: 600; }
.tmf-cm-msgs .tmf-cm-reply { border-top: 1px solid var(--line); padding-top: 16px; }
.tmf-cm-threadhead { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.tmf-cm-threadhead > div:nth-child(2) { flex: 1 1 220px; min-width: 0; }
.tmf-cm-threadhead p { margin: 4px 0 0; }
.tmf-cm-convos { list-style: none; margin: 0; padding: 0; }
.tmf-cm-convos li { border-top: 1px solid var(--line); }
.tmf-cm-convos li:first-child { border-top: 0; }
.tmf-cm-convos a { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--ink); text-decoration: none; }
.tmf-cm-convos a:hover strong { color: var(--accent); }
.tmf-cm-convos__txt { flex: 1; min-width: 0; display: grid; }
.tmf-cm-convos__txt .tmf-muted { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmf-cm-convos__when { font-size: .8rem; white-space: nowrap; display: grid; justify-items: end; gap: 4px; }
.tmf-cm-convos li.is-new strong { color: var(--accent); }
.tmf-cm-compose { margin-bottom: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.tmf-cm-cols, .tmf-cm-dash { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
	.tmf-cm-policy__steps { grid-template-columns: 1fr; }
	.tmf-cm-head { gap: 14px; }
	.tmf-cm-head .tmf-av { width: 64px !important; height: 64px !important; }
	.tmf-cm-head__actions { width: 100%; }
	.tmf-cm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tmf-cm-stats strong { font-size: 1.35rem; }
	.tmf-cm-rules { padding: 14px 14px 10px; }
	.tmf-cm-rules--scroll .tmf-cm-rules__list { max-height: 220px; }
	.tmf-cm-msg { max-width: 100%; }
	.tmf-cm-strike .tmf-report__form, .tmf-cm-head__actions .tmf-report__form { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; z-index: 50; }
	.tmf-cm-points td:first-child { min-width: 0; }
	.tmf-cm-points td:nth-child(2) { white-space: normal; font-size: .85rem; }
	.tmf-cm-points th, .tmf-cm-points td { padding: 10px 8px; }
	.tmf-cm-settings form { padding: 0 16px 16px; }
}

/* ---------- Mobile fixes for existing screens ---------- */
/* Screen-reader-only labels inside tables must not stretch the page. */
.tmf-table-wrap { position: relative; }
/* Profile tab: long upload hint links and the file input pushed the form past the screen. */
.tmf-form > *, .tmf-avatar-field > *, .tmf-grid2 > * { min-width: 0; }
.tmf-form input[type=file] { max-width: 100%; }
.tmf-upload-hint, .tmf-upload-hint a { overflow-wrap: anywhere; white-space: normal; }
@media (max-width: 480px) { .tmf-avatar-field { flex-wrap: wrap; } }

/* ---------- Night readability fixes for existing screens ---------- */
body.tmf-night .tmf-alert-strip { background: #3A2F14; border-color: #6B5520; color: #F2D58A; }
body.tmf-night .tmf-alert-strip:hover { border-color: #F2C46B; color: #F2D58A; }
body.tmf-night .tmf-alert-strip__title { color: var(--ink); }
body.tmf-night .tmf-alert-strip .tmf-ico { color: #F2C46B; }
body.tmf-night .tmf-alert-strip--water .tmf-ico { color: #8CC3D3; }
body.tmf-night .tmf-alert-strip--safety .tmf-ico { color: #F59472; }
body.tmf-night .tmf-access--review { color: #F2D58A; background: #3A2F14; }
body.tmf-night .tmf-artist__disc { color: color-mix(in srgb, var(--artist, #8CC3D3) 40%, #EEF0EA); }
body.tmf-night .tmf-badge--org { color: #F4F6EC; }
