/* CTS Comms — bell, messages, notifications. Function-first, minimal. */

[x-cloak] { display: none !important; }

/* ---------- Bell ---------- */
.cts-bell-root { position: fixed; top: 12px; right: 16px; z-index: 99990; font-size: 14px; }
.cts-bell-btn { position: relative; background: #fff; border: 1px solid #d4d4d8; border-radius: 50%; width: 40px; height: 40px; cursor: pointer; line-height: 1; }
.cts-bell-icon { font-size: 18px; }
.cts-bell-count { position: absolute; top: -4px; right: -4px; background: #dc2626; color: #fff; border-radius: 10px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 11px; line-height: 18px; text-align: center; }
.cts-bell-panel { position: absolute; right: 0; top: 48px; width: 340px; max-width: 90vw; background: #fff; border: 1px solid #d4d4d8; border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.16); overflow: hidden; }
.cts-bell-head, .cts-bell-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #eee; }
.cts-bell-foot { border-bottom: 0; border-top: 1px solid #eee; }
.cts-bell-allread { background: none; border: 0; color: #2563eb; cursor: pointer; font-size: 12px; }
.cts-bell-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.cts-bell-list li { border-bottom: 1px solid #f2f2f2; }
.cts-bell-list li a { display: block; padding: 10px 12px; color: inherit; text-decoration: none; }
.cts-bell-list li.is-unread { background: #f0f7ff; }
.cts-bell-title { display: block; font-weight: 600; }
.cts-bell-body { display: block; color: #555; font-size: 13px; }
.cts-bell-time { display: block; color: #999; font-size: 11px; margin-top: 2px; }
.cts-bell-empty { padding: 16px; color: #777; text-align: center; }

/* ---------- Shared ---------- */
.cts-flash { padding: 10px 14px; border-radius: 6px; margin: 0 0 14px; }
.cts-flash--ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.cts-flash--err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.cts-btn { background: #2563eb; color: #fff; border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; }
.cts-btn--ghost { background: transparent; color: #2563eb; border: 1px solid #2563eb; }
.cts-link { background: none; border: 0; color: #2563eb; cursor: pointer; padding: 0; font-size: 13px; }
.cts-empty { color: #777; }
.cts-help { color: #555; font-size: 14px; }

/* ---------- Messages ---------- */
.cts-messages { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media (max-width: 720px) { .cts-messages { grid-template-columns: 1fr; } }
.cts-thread-list ul { list-style: none; margin: 0; padding: 0; }
.cts-thread-item { border-bottom: 1px solid #eee; }
.cts-thread-item a { display: block; padding: 10px 8px; color: inherit; text-decoration: none; }
.cts-thread-item.is-active { background: #f0f7ff; }
.cts-thread-prov { display: block; font-weight: 600; }
.cts-thread-ref { display: block; font-size: 12px; color: #888; }
.cts-modnote { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 6px 10px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.cts-msg-list { list-style: none; margin: 0 0 16px; padding: 0; }
.cts-msg { border: 1px solid #eee; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; max-width: 80%; }
.cts-msg.is-me { margin-left: auto; background: #f0f7ff; border-color: #cfe3ff; }
.cts-msg-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: #888; margin-bottom: 4px; }
.cts-msg-body { white-space: pre-wrap; word-break: break-word; }
.cts-reply textarea { width: 100%; box-sizing: border-box; margin-bottom: 8px; }

/* ---------- Notifications page ---------- */
.cts-notifications { display: grid; grid-template-columns: 1fr; gap: 28px; }
.cts-notif-head { display: flex; justify-content: space-between; align-items: center; }
.cts-notif-list { list-style: none; margin: 0; padding: 0; }
.cts-notif-item { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid #eee; }
.cts-notif-item.is-unread { background: #f6faff; }
.cts-notif-type { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #2563eb; }
.cts-notif-title { display: block; font-weight: 600; }
.cts-notif-body { display: block; color: #555; font-size: 13px; }
.cts-notif-time { display: block; color: #999; font-size: 12px; }
.cts-notif-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; white-space: nowrap; }
.cts-pager { margin-top: 12px; display: flex; gap: 16px; }
.cts-pref-group { border: 1px solid #eee; border-radius: 8px; margin: 0 0 16px; padding: 8px 14px 14px; }
.cts-pref-group legend { font-weight: 600; padding: 0 6px; }
.cts-pref-table { width: 100%; border-collapse: collapse; }
.cts-pref-table th, .cts-pref-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #f2f2f2; }
.cts-pref-table th[scope="col"] { font-size: 12px; color: #777; }
.cts-pref-table td { text-align: center; width: 90px; }
.cts-na { color: #ccc; }
