/* ADR 0035 — community (discussion, study groups, achievements).
   Prefixes: disc- (discussion), grp- (groups), ach- (achievements). Scoped so nothing here leaks. */

/* ── discussion (slot L, inside the feedback view) ───────────────────────────── */
.disc { margin-top: 1rem; border-top: 1px solid #e6e8ee; padding-top: .75rem; }
.disc-toggle {
    display: inline-flex; align-items: center; gap: .4rem; background: none; border: 0;
    font-weight: 600; color: #2b3a55; cursor: pointer; padding: .25rem 0; font-size: .95rem;
}
.disc-caret { font-size: .8rem; color: #8a93a6; }
.disc-body { margin-top: .5rem; }
.disc-empty, .disc-cannot { color: #6b7280; font-size: .9rem; margin: .5rem 0; }
.disc-cannot { background: #f5f6f9; border-radius: 8px; padding: .5rem .7rem; }
.disc-footer { margin-top: .9rem; font-size: .8rem; color: #9aa2b1; font-style: italic; }

.disc-post { padding: .6rem .7rem; border: 1px solid #eceef3; border-radius: 10px; margin-bottom: .5rem; background: #fff; }
.disc-post--reply { margin-left: 1.5rem; background: #fbfcfe; }
.disc-post--held { border-color: #f0d8a8; background: #fffaf0; }
.disc-post--staff { border-color: #cfe3d6; background: #f6fbf7; }
.disc-post-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.disc-author { font-weight: 600; color: #2b3a55; font-size: .9rem; }
.disc-time { color: #9aa2b1; font-size: .8rem; margin-left: auto; }
.disc-text { margin: .1rem 0 .4rem; white-space: pre-wrap; color: #2f3542; font-size: .92rem; }
.disc-held-note { color: #a5761b; font-size: .8rem; margin: .2rem 0; }

.disc-badge { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .1rem .4rem; border-radius: 999px; }
.disc-badge--staff { background: #e3f0e8; color: #2c7a4b; }
.disc-badge--answer { background: #e6eefb; color: #2b5cbf; }
.disc-badge--pin { background: #f3ecda; color: #99771f; }

.disc-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.disc-btn {
    background: #f2f4f8; border: 1px solid #e3e7ee; border-radius: 7px; padding: .2rem .55rem;
    font-size: .8rem; color: #46506a; cursor: pointer;
}
.disc-btn:hover:not(:disabled) { background: #e9edf4; }
.disc-btn:disabled { opacity: .5; cursor: default; }
.disc-btn--primary { background: #2b5cbf; border-color: #2b5cbf; color: #fff; }
.disc-btn--primary:hover:not(:disabled) { background: #24509f; }
.disc-btn--danger { color: #b23838; }
.disc-btn--add { margin-top: .4rem; }
.disc-vote.is-voted { background: #e6eefb; border-color: #b9cdf0; color: #2b5cbf; }

.disc-input { margin: .3rem 0; font-size: .9rem; }
.disc-reply-box, .disc-report { margin-top: .4rem; }
.disc-report-reason, .disc-report-note { margin: .25rem 0; }
.disc-error { color: #b23838; font-size: .85rem; margin: .35rem 0; }

/* the display-name dialog (shared) */
.disc-modal-backdrop { position: fixed; inset: 0; background: rgba(20, 26, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 1050; padding: 1rem; }
.disc-modal { background: #fff; border-radius: 14px; padding: 1.25rem; max-width: 420px; width: 100%; box-shadow: 0 12px 40px rgba(20, 26, 40, .25); }
.disc-modal-title { margin: 0 0 .3rem; font-size: 1.1rem; }
.disc-modal-sub { color: #6b7280; font-size: .88rem; margin-bottom: .6rem; }
.disc-name-input { margin-bottom: .5rem; }
.disc-check { display: flex; gap: .5rem; align-items: flex-start; font-size: .85rem; color: #46506a; margin-bottom: .6rem; }
.disc-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* admin queue helpers */
.disc-admin-body { max-width: 30rem; white-space: pre-wrap; }
.disc-admin-reports { margin: .3rem 0 0; padding-left: 1rem; font-size: .8rem; color: #b23838; }
.disc-admin-stem { max-width: 16rem; }
.disc-admin-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.disc-admin-reply, .disc-admin-ban { margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }

/* ── study groups ────────────────────────────────────────────────────────────── */
/* Surfaces are paper (--mx-nav-card) on the theme's tokens. This block used to be
   hardcoded light hex with no backgrounds at all, so the group cards and the two forms
   sat as bare outlines on the cream ground - and went wrong entirely in dark. */
.grp-shell { max-width: 860px; margin: 0 auto; }
.grp-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.grp-title { margin: 0; font-size: 1.5rem; }
.grp-sub { color: var(--bs-secondary-color); margin: .2rem 0 0; }
.grp-section-title { font-size: 1.05rem; margin: 1.2rem 0 .6rem; color: var(--bs-heading-color); }
.grp-empty { color: var(--bs-secondary-color); }

.grp-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.grp-card { border: 1px solid var(--bs-border-color); border-radius: 12px; padding: .8rem 1rem; background: var(--mx-nav-card); box-shadow: var(--mx-elevation-sm); }
.grp-card-main { display: flex; justify-content: space-between; align-items: baseline; text-decoration: none; color: inherit; }
.grp-card-name { font-weight: 600; color: var(--bs-heading-color); }
.grp-card-meta { color: var(--bs-secondary-color); font-size: .85rem; }
.grp-badge { font-size: .68rem; font-weight: 700; text-transform: uppercase; background: rgba(var(--bs-primary-rgb), .12); color: var(--bs-primary); padding: .08rem .4rem; border-radius: 999px; margin-left: .35rem; }

.grp-goal { margin-top: .5rem; }
.grp-goal-bar { height: 10px; background: var(--bs-tertiary-bg); border-radius: 999px; overflow: hidden; }
.grp-goal-fill { display: block; height: 100%; background: var(--mx-teal); border-radius: 999px; transition: width .3s ease; }
.grp-goal--large .grp-goal-bar { height: 16px; }
.grp-goal-label { display: inline-block; margin-top: .3rem; font-size: .82rem; color: var(--bs-secondary-color); }

.grp-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.grp-form { border: 1px solid var(--bs-border-color); border-radius: 14px; padding: 1.1rem 1.2rem; display: grid; gap: .5rem; align-content: start; background: var(--mx-nav-card); box-shadow: var(--mx-elevation-sm); }
.grp-field { display: grid; gap: .2rem; font-size: .85rem; color: var(--bs-secondary-color); }
.grp-goal-input, .grp-code-input { max-width: 12rem; }

.grp-member-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.grp-member { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--bs-border-color); border-radius: 10px; padding: .5rem .7rem; background: var(--mx-nav-card); }
.grp-member-name { font-weight: 600; color: var(--bs-heading-color); }
.grp-member-activity { color: var(--bs-secondary-color); font-size: .82rem; margin-left: auto; }
.grp-member-activity--private { font-style: italic; color: var(--bs-tertiary-color); }
.grp-remove { margin-left: .5rem; background: none; border: 0; color: var(--bs-danger); cursor: pointer; font-size: .82rem; }

.grp-invite-row { display: flex; gap: .5rem; align-items: center; }
.grp-invite-code { font-size: .9rem; color: var(--bs-secondary-color); }
.grp-board-post { display: grid; gap: .4rem; margin-bottom: .8rem; }
.grp-board-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.grp-board-post-item { border: 1px solid var(--bs-border-color); border-radius: 10px; padding: .5rem .7rem; background: var(--mx-nav-card); }
.grp-board-post-item.is-held { background: color-mix(in srgb, #e0a43b 10%, var(--mx-nav-card)); border-color: color-mix(in srgb, #e0a43b 40%, var(--bs-border-color)); }
.grp-board-head { display: flex; justify-content: space-between; font-size: .82rem; }
.grp-board-author { font-weight: 600; color: var(--bs-heading-color); }
.grp-board-time { color: var(--bs-tertiary-color); }
.grp-board-body { margin: .25rem 0 0; white-space: pre-wrap; font-size: .9rem; }
.grp-owner-edit, .grp-owner-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.grp-leave { margin-top: 1.5rem; }
.grp-join-prompt { text-align: center; padding: 2rem 1rem; }
.grp-namebox { text-align: left; }

@media (max-width: 640px) { .grp-forms { grid-template-columns: 1fr; } }

/* ── achievements ────────────────────────────────────────────────────────────── */
.ach-shell { max-width: 860px; margin: 0 auto; }
.ach-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.ach-title { margin: 0; font-size: 1.5rem; }
.ach-sub { color: var(--bs-secondary-color); margin: .2rem 0 0; }
.ach-count { color: var(--bs-heading-color); font-weight: 600; }
.ach-section-title { font-size: 1.05rem; margin: 1.2rem 0 .6rem; color: var(--bs-heading-color); }
.ach-empty { color: var(--bs-secondary-color); }

.ach-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; }
/* Paper tiles; an earned one carries a faint teal cast over the paper. They were bare
   outlines on the cream ground (locked ones especially) with hardcoded light greys. */
.ach-card { display: flex; gap: .7rem; align-items: center; border: 1px solid var(--bs-border-color); border-radius: 12px; padding: .8rem; background: var(--mx-nav-card); box-shadow: var(--mx-elevation-sm); }
.ach-card--earned { background: color-mix(in srgb, var(--mx-teal) 6%, var(--mx-nav-card)); border-color: color-mix(in srgb, var(--mx-teal) 35%, var(--bs-border-color)); }
.ach-card--locked { opacity: .75; box-shadow: none; }
.ach-card-title { font-weight: 600; margin: 0; color: var(--bs-heading-color); }
.ach-card-desc { margin: .15rem 0 0; font-size: .85rem; color: var(--bs-secondary-color); }
.ach-card-hint { font-style: italic; }
.ach-card-when { margin: .2rem 0 0; font-size: .78rem; color: var(--bs-tertiary-color); }
.ach-card--locked.is-started { opacity: 1; }
.ach-card-body { min-width: 0; flex: 1; }
a.ach-card-go { display: inline-block; color: var(--bs-secondary-color); text-decoration: none; }
a.ach-card-go:hover { color: var(--mx-teal-ink); text-decoration: underline; }
.ach-progress { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; }
.ach-progress-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--bs-tertiary-bg); overflow: hidden; }
.ach-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--mx-teal-ink); }
.ach-progress-n { font-family: var(--mx-font-mono); font-size: .72rem; color: var(--bs-secondary-color); white-space: nowrap; }

/* Emoji-free CSS icon tokens: a tinted rounded chip per icon name, with a line glyph
   masked in a darker ink of the same hue. The chips used to be colour alone, which read
   as twelve empty squares - as if the images had failed to load. The glyphs are Feather
   strokes inlined as SVG masks, so they take the ink colour and grey out with the chip. */
.ach-ico {
  position: relative; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  background: #e6eefb; box-shadow: inset 0 0 0 1px rgba(43, 92, 191, .12);
  --ach-ink: #2b5cbf;
}
.ach-ico::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px;
  background-color: var(--ach-ink);
  -webkit-mask: var(--ach-glyph) center / contain no-repeat; mask: var(--ach-glyph) center / contain no-repeat;
}
.ach-ico--muted { filter: grayscale(1); opacity: .6; }
.ach-ico--mock      { background: #e6eefb; --ach-ink: #2b5cbf; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 11l3 3L22 4'/><path d='M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11'/></svg>"); }
.ach-ico--pass      { background: #e3f0e8; --ach-ink: #1f7a4d; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='6'/><path d='M8.2 13.9 7 23l5-3 5 3-1.2-9.1'/></svg>"); }
.ach-ico--streak    { background: #fdeede; --ach-ink: #d9671b; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 22c4 0 7-2.8 7-7 0-3.5-2.5-5.5-3.5-8-1 2-2 2.6-2.5 3.2C12.3 8.5 11 6 11 3c-3 2-6 6.2-6 11 0 4.6 3 8 7 8z'/><path d='M12 22c-1.7 0-3-1.3-3-3 0-1.6 1.2-2.3 2-4 .8 1.7 4 2.4 4 4 0 1.7-1.3 3-3 3z'/></svg>"); }
.ach-ico--review    { background: #eae6fb; --ach-ink: #5b48c2; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M1 4v6h6'/><path d='M3.5 15a9 9 0 1 0 2.1-9.4L1 10'/></svg>"); }
.ach-ico--cards     { background: #e6f4fb; --ach-ink: #1f6f9f; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2 2 7l10 5 10-5-10-5z'/><path d='m2 17 10 5 10-5'/><path d='m2 12 10 5 10-5'/></svg>"); }
.ach-ico--mastery   { background: #e9f7ee; --ach-ink: #1f7a4d; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><circle cx='12' cy='12' r='6'/><circle cx='12' cy='12' r='2'/></svg>"); }
.ach-ico--fix       { background: #fbe9e6; --ach-ink: #b8402d; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/></svg>"); }
.ach-ico--placement { background: #eef1f6; --ach-ink: #3f4d66; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m16.24 7.76-2.12 6.36-6.36 2.12 2.12-6.36 6.36-2.12z'/></svg>"); }
.ach-ico--plan      { background: #f3ecda; --ach-ink: #9a6b12; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><path d='M16 2v4M8 2v4M3 10h18'/></svg>"); }
.ach-ico--case      { background: #ece6fb; --ach-ink: #5b48c2; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path d='M14 2v6h6M16 13H8M16 17H8M10 9H8'/></svg>"); }
.ach-ico--helpful   { background: #e6f0fb; --ach-ink: #2b5cbf; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z'/></svg>"); }
.ach-ico--share     { background: #e3f0e8; --ach-ink: #1f7a4d; --ach-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='18' cy='5' r='3'/><circle cx='6' cy='12' r='3'/><circle cx='18' cy='19' r='3'/><path d='m8.59 13.51 6.82 3.98M15.41 6.51l-6.82 3.98'/></svg>"); }

/* dashboard toast (slot #5) */
.ach-toast {
    display: flex; align-items: center; gap: .7rem; border: 1px solid #d7e7dc; background: #f6fbf7;
    border-radius: 12px; padding: .7rem .8rem; margin-top: .6rem;
    animation: ach-toast-in .3s ease both;
}
.ach-toast-icon { width: 34px; height: 34px; }
.ach-toast-body { flex: 1; }
.ach-toast-title { margin: 0; font-weight: 600; color: #2c7a4b; font-size: .95rem; }
.ach-toast-sub { margin: .1rem 0 0; font-size: .82rem; color: #6b7280; }
.ach-toast-actions { display: flex; flex-direction: column; gap: .25rem; align-items: flex-end; }
.ach-toast-link { font-size: .8rem; color: #2b5cbf; text-decoration: none; }
.ach-toast-dismiss { background: none; border: 0; color: #8a93a6; font-size: .8rem; cursor: pointer; }

@keyframes ach-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ach-toast { animation: none; } }
