.topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.topic-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  overflow-wrap: anywhere;
}
button.topic-card:hover { border-color: #8cb29a; }
.topic-symbol { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 9px; background: var(--green-soft); color: var(--green); flex: none; }
.topic-card strong, .topic-card small { display: block; }
.topic-card small { margin-top: 4px; }

.notification-list { padding: 6px 14px; }
.notice-row { display: flex; align-items: flex-start; gap: 11px; width: 100%; padding: 13px 8px; border: 0; background: transparent; text-align: left; color: var(--ink); overflow-wrap: anywhere; }
.notice-row + .notice-row { border-top: 1px solid var(--line); }
.notice-row:hover { background: var(--paper); }
.notice-row time { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 7px; background: #a7b7aa; }
.notice-row.unread .notice-dot { background: var(--coral); }
.profile-head, .profile-actions, .account-actions { display: flex; align-items: center; gap: 12px; }
.profile-author { min-width: 0; overflow-wrap: anywhere; }
.profile-author h2 { font-size: 1.24rem; margin: 0; }
.profile-author p { margin: 5px 0 0; }
.badged-name { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; min-width: 0; overflow-wrap: anywhere; }
.badged-name > :first-child { min-width: 0; }
.title-red { --title-ink: #8f203a; --title-bg: #ffe5eb; --title-light: #fff8fa; --title-line: #e6a4b3; --title-swatch: #c84260; }
.title-gold { --title-ink: #725014; --title-bg: #ffedb8; --title-light: #fff9e7; --title-line: #dfbd6c; --title-swatch: #c7932d; }
.title-purple { --title-ink: #632a89; --title-bg: #f0e1ff; --title-light: #fcf8ff; --title-line: #c8a3e8; --title-swatch: #8a4bb5; }
.title-blue { --title-ink: #194e83; --title-bg: #deedff; --title-light: #f6fbff; --title-line: #95bce5; --title-swatch: #3778bc; }
.title-green { --title-ink: #15583f; --title-bg: #dbf3e7; --title-light: #f5fcf8; --title-line: #8bbfa6; --title-swatch: #338061; }
.title-white { --title-ink: #414957; --title-bg: #f5f7fa; --title-light: #fff; --title-line: #aeb8c5; --title-swatch: #fff; }
.title-badge {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0;
  padding: 3px 7px; border: 1px solid var(--title-line); border-radius: 6px;
  background: linear-gradient(165deg, var(--title-light) 8%, var(--title-bg) 94%);
  color: var(--title-ink); font-size: .75rem; font-weight: 750; line-height: 1.24;
  overflow-wrap: anywhere; box-shadow: inset 0 1px 0 #fff9;
}
.title-badge .icon { width: 13px; height: 13px; }
/* Only the foil moves; the type and role symbol stay sharp and still. */
@media (prefers-reduced-motion: no-preference) {
  .title-badge::before {
    content: ''; position: absolute; inset: -20% 0; z-index: -1; pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, #ffffffb3 48%, #ffffff40 55%, transparent 70%);
    animation: badge-sheen 6s ease-in-out infinite;
  }
  .title-badge.title-white::before { background: linear-gradient(110deg, transparent 30%, #cbd6e58c 48%, white 55%, transparent 70%); }
  @keyframes badge-sheen {
    0% { transform: translateX(-105%); }
    26%, 100% { transform: translateX(105%); }
  }
}
.title-editor-preview { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 58px; padding: 10px 12px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); }
.title-editor-preview .badged-name { flex: 1; }
.title-editor-preview [data-title-preview] { min-width: 0; }
.title-preview-label { flex: none; align-self: flex-start; }
.title-palette { margin: 0; padding: 0; border: 0; }
.title-palette legend { margin-bottom: 7px; padding: 0; font-size: .88rem; font-weight: 650; }
.title-palette-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); gap: 7px; }
.title-choice { position: relative; min-width: 0; cursor: pointer; }
.title-choice input { position: absolute; width: 1px; height: 1px; margin: 0; clip-path: inset(50%); }
.title-choice span { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; font-size: .8rem; }
.title-choice span::before { content: ''; width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--title-swatch); border: 1px solid var(--title-line); }
.title-choice:hover span { border-color: var(--title-swatch); }
.title-choice input:checked + span { color: var(--title-ink); border-color: var(--title-line); background: var(--title-bg); box-shadow: inset 0 0 0 1px var(--title-line); font-weight: 720; }
.title-choice input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.title-edit-actions .title-remove { order: -1; margin-inline-end: auto; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 18px; padding: 17px 0; color: var(--muted); font-size: .87rem; }
.profile-stats strong { color: var(--ink); }
.profile-actions, .account-actions { flex-wrap: wrap; }
.account-actions { margin-top: 20px; }
.profile-tabs { display: flex; gap: 9px; margin: 13px 0; overflow-x: auto; }
.profile-tabs button { min-height: 42px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); white-space: nowrap; padding: 7px 8px; }
.profile-tabs button.selected { border-bottom-color: var(--green); color: var(--green); font-weight: 720; }
.draft-card { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; }
.draft-card h3, .draft-card p { margin: 0; overflow-wrap: anywhere; }

.admin-tabs, .admin-return { display: none; }
.admin-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-item { padding: 15px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.summary-item strong { display: block; margin-top: 4px; font-size: 1.42rem; color: var(--green-dark); }
.summary-item span { font-size: .82rem; color: var(--muted); }
.admin-toolbar, .admin-search { display: flex; align-items: center; gap: 8px; min-width: 0; }
.admin-toolbar { justify-content: space-between; margin-bottom: 12px; }
.admin-toolbar p { margin: 0; }
.admin-cover-thumb { display: block; width: 125px; max-width: 100%; aspect-ratio: 3 / 1; object-fit: cover; border-radius: 5px; }
.cover-up .icon { transform: rotate(-90deg); }
.cover-down .icon { transform: rotate(90deg); }
.cover-editor .upload-field { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.cover-editor .file-preview { width: 100%; aspect-ratio: 3.5 / 1; object-fit: cover; }
.cover-editor .textarea { min-height: 65px; }
.admin-search { max-width: 375px; }
.admin-search .button { flex: none; }
.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.table-heading { font-size: 1.05rem; margin: 20px 0 10px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: #fff; border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th, .data-table td { padding: 12px; font-size: .86rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.data-table th { background: #f7faf7; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td small { display: block; margin-top: 3px; }
.data-table td > .title-badge { justify-self: start; }
.table-user { display: flex; align-items: center; gap: 10px; }
.table-user .avatar { width: 31px; height: 31px; }
.table-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.table-actions .button { min-height: 32px; font-size: .8rem; padding: 0 8px; }
.status-pill { display: inline-block; padding: 4px 7px; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); font-size: .76rem; white-space: nowrap; }
.status-pill.off { color: var(--coral); background: var(--coral-soft); }
.role-select { max-width: 190px; }

.modal {
  width: min(540px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.modal.wide { width: min(715px, calc(100% - 24px)); }
.modal::backdrop { background: #182b22a3; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; padding: 13px 17px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.modal-head h2 { margin: 0; font-size: 1.12rem; overflow-wrap: anywhere; }
.modal-body { padding: 18px; }
.modal-form { display: grid; gap: 14px; }
.confirm-copy { margin: 0 0 13px; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.detail-body { margin-top: 13px; }
.comment-heading { margin: 19px 0 11px; font-size: 1rem; }
.comment-heading span { font-size: .8rem; color: var(--muted); }
.comment-list { display: grid; gap: 11px; margin-bottom: 12px; }
.comment { display: flex; align-items: flex-start; gap: 9px; }
.comment .avatar { width: 30px; height: 30px; }
.comment-content { min-width: 0; font-size: .875rem; }
.comment-content p { margin: 3px 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-content time { font-size: .77rem; color: var(--muted); }
.modal-comment-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 16px; align-items: start; border-top: 1px solid var(--line); padding-top: 11px; }
.modal-comment-form > .field { grid-column: 1 / -1; }
.identity-field { min-width: 0; }
.anonymous-choice { min-height: 32px; display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 650; cursor: pointer; }
.anonymous-choice input { width: 17px; height: 17px; margin: 0; accent-color: var(--green); }
.identity-field small { display: block; font-size: .76rem; line-height: 1.5; color: var(--muted); }
.anonymous-avatar .icon { width: 52%; height: 52%; }
.file-pick { position: relative; cursor: pointer; }
.file-pick:focus-within { outline: 2px solid #428361; outline-offset: 2px; }
.file-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.upload-field [data-preview]:not(:empty) { margin-top: 8px; }
.file-preview { display: block; max-width: 100%; max-height: 180px; border-radius: 9px; }
.avatar-preview { width: 66px; height: 66px; border-radius: 50%; object-fit: cover; }
.toast { padding: 10px 14px; border-radius: 8px; background: #273c30; color: #fff; font-size: .88rem; box-shadow: var(--shadow); }
.toast.error { background: #934335; }
#toast-root { position: fixed; z-index: 40; bottom: 18px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); pointer-events: none; }
[data-dialog-status]:not(:empty) { padding: 0 18px 14px; }

.site-settings { max-width: 640px; }
.site-settings h2 { font-size: 1.05rem; margin: 0; }
.site-settings p { font-size: .9rem; line-height: 1.65; margin: 8px 0 22px; }
.site-settings .form-actions { justify-content: flex-start; margin-top: 4px; }
.register-contact,.qr-editor { margin:0; padding:10px 12px 12px; border:1px solid var(--line); border-radius:8px; min-width:0; }
.register-contact legend,.qr-editor legend { padding:0 5px; font-weight:650; font-size:.88rem; }
.contact-fields { display:grid; grid-template-columns:76px minmax(0,1fr); gap:8px; }
.contact-fields label { display:grid; gap:4px; color:var(--muted); font-size:.8rem; }
.qr-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:14px; }
.qr-card { margin:0; min-width:0; text-align:center; }
.qr-card figcaption { font-size:.86rem; font-weight:650; margin-bottom:7px; }
.qr-card img,.qr-empty { width:100%; aspect-ratio:1; display:grid; place-items:center; object-fit:contain; padding:5px; border:1px solid #d8e2e8; border-radius:5px; background:white; }
.qr-empty { border-style:dashed; font-size:.78rem; color:#566c78; }
.qr-editor { display:grid; gap:9px; }
.qr-editor .qr-thumbnail { display:block; width:104px; height:104px; object-fit:contain; background:white; border:1px solid var(--line); }
.qr-editor .qr-buttons { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.qr-editor input[type=file] { max-width:100%; }
.qr-editor button { min-height:32px; }
