/* ===== Irifyen community ===== */
.cm { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: 20px; padding: 22px 0 40px; align-items: start; }
.cm-left, .cm-right { position: sticky; top: 62px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 80px); }
.cm-right { overflow: hidden; }
.cm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.cm svg { max-width: 100%; }
.cm-me { display: flex; gap: 10px; align-items: center; }
.cm-me .nm { font-weight: 700; }
.cm-nav { display: flex; flex-direction: column; gap: 2px; }
.cm-nav a, .cm-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14.5px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--muted); }
.cm-nav a.on, .cm-nav a:hover, .cm-nav button:hover { background: var(--brand-soft); color: var(--ink); }
.cm-nav svg { width: 18px; height: 18px; flex: none; }
.cm-badge { margin-left: auto; background: var(--hot); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.cm-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.cm-h h2 { font-size: 26px; }
.cm-h h4 { margin: 0; font-size: 14px; }
.cm-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.cm-person { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 10px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; color: inherit; }
.cm-person:hover, .cm-person.on { background: var(--paper); }
.cm-person .nm { font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.cm-person .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-person .km { font-size: 12px; color: var(--brand); font-weight: 700; white-space: nowrap; }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; position: relative; flex: none; background: var(--brand); overflow: visible; font-size: 15px; }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av.lg { width: 88px; height: 88px; font-size: 32px; }
.av.sm { width: 32px; height: 32px; font-size: 13px; }
.av.on::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #22C55E; border: 2px solid var(--surface); }

/* feed */
.composer textarea { min-height: 70px; border: 0; padding: 4px 0; background: transparent; resize: none; font-size: 16px; }
.composer textarea:focus { outline: none; }
.composer .bar { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; flex-wrap: wrap; }
.tool { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.tool svg { width: 16px; height: 16px; }
.tool.rec { background: var(--hot); color: #fff; border-color: transparent; }
.tool.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.attach-prev { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.attach-prev img { max-height: 120px; border-radius: 10px; }
.post { display: flex; flex-direction: column; gap: 10px; }
.post + .post { margin-top: 14px; }
.post .head { display: flex; gap: 10px; align-items: center; }
.post .head .nm { font-weight: 700; cursor: pointer; }
.post .head .sub { font-size: 12.5px; color: var(--muted); }
.post .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; }
.post .media img { width: 100%; max-height: 560px; object-fit: cover; border-radius: 12px; cursor: zoom-in; }
.post .acts { display: flex; gap: 6px; }
.post .acts button { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 8px; font-weight: 600; }
.post .acts button:hover { background: var(--paper); }
.post .acts .liked { color: var(--hot); }
.doc { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; text-decoration: none; font-weight: 600; font-size: 14px; background: var(--paper); }
audio { width: 100%; max-width: 360px; height: 40px; }

/* chat */
.thread { display: flex; flex-direction: column; height: calc(100vh - 80px); min-height: 420px; scroll-margin-top: 58px; padding: 0; overflow: hidden; }
.thread .top { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.thread .top .nm { font-weight: 700; }
.thread .msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--paper); }
.bub { max-width: 76%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.bub.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-color: transparent; border-radius: 16px 16px 4px 16px; }
.bub .t { font-size: 11px; opacity: .65; margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.bub .t button { border: 0; background: none; color: inherit; font-size: 11px; padding: 0; cursor: pointer; opacity: .9; }
.bub img { max-width: 100%; max-height: 340px; border-radius: 10px; margin-bottom: 4px; cursor: zoom-in; }
.once-btn svg { width: 18px; height: 18px; }
.once-btn { display: inline-flex; gap: 8px; align-items: center; border: 1px dashed currentColor; border-radius: 12px; padding: 8px 12px; background: none; color: inherit; cursor: pointer; font-weight: 700; }
.thread .compose { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.thread .compose .row1 { display: flex; gap: 8px; align-items: flex-end; }
.thread .compose textarea { min-height: 42px; max-height: 140px; flex: 1; resize: none; }

/* people */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.pcard .top { display: flex; gap: 12px; align-items: center; }
.pcard .nm { font-weight: 700; font-size: 16px; }
.pcard .sub { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; border-radius: 999px; padding: 3px 10px; background: var(--brand-soft); color: var(--ink); border: 1px solid transparent; }
label.chip { cursor: pointer; border-color: var(--line); background: var(--surface); font-size: 13px; padding: 5px 12px; }
label.chip input { display: none; }
label.chip:has(input:checked) { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.filters { display: grid; grid-template-columns: 1fr 180px 160px auto; gap: 8px; margin-bottom: 14px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }

/* auth */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: start; padding: 26px 0 40px; }
.auth-hero { background: var(--ink); color: var(--paper); border-radius: 22px; padding: 30px; position: relative; overflow: hidden; }
.auth-hero::after { content: "ⵣ"; position: absolute; right: -20px; bottom: -80px; font-size: 300px; line-height: 1; opacity: .07; }
.auth-hero h2 { font-size: clamp(30px, 4vw, 44px); margin: 8px 0 12px; }
.auth-hero p { color: color-mix(in srgb, var(--paper) 78%, transparent); }
.auth-hero ul { padding-left: 18px; color: color-mix(in srgb, var(--paper) 85%, transparent); }
.auth-hero li { margin: 6px 0; }
.seg2 { display: flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 12px; }
.seg2 button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 8px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg2 button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.err { color: var(--hot); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* join prompt */
.join-pop { position: fixed; left: 18px; bottom: 18px; z-index: 95; width: min(380px, calc(100vw - 36px)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.22); padding: 18px; transform: translateY(20px); opacity: 0; transition: .35s; pointer-events: none; }
.join-pop.show { transform: none; opacity: 1; pointer-events: auto; }
.join-pop h3 { font-size: 20px; margin: 6px 0 6px; }
.join-pop p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.join-pop .x { position: absolute; right: 10px; top: 10px; }
.join-pop form { display: flex; gap: 8px; }
.fab-badge { position: absolute; top: -4px; right: -4px; background: var(--hot); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; font-weight: 800; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 130; display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

.cm-mobile-tabs { display: none; }
@media (max-width: 1100px) { .cm { grid-template-columns: 210px minmax(0, 1fr); } .cm-right { display: none; } .cm.show-right .cm-right { display: flex; } }
@media (max-width: 760px) {
  .cm { grid-template-columns: 1fr; padding-top: 12px; padding-bottom: 80px; }
  .cm-left { display: none; }
  .cm-right { position: static; max-height: none; }
  .cm-mobile-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 96; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .cm-mobile-tabs a { flex: 1; text-align: center; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
  .cm-mobile-tabs a.on { color: var(--brand); }
  .cm-mobile-tabs svg { width: 22px; height: 22px; }
  .thread { height: calc(100vh - 150px); }
  .filters { grid-template-columns: 1fr 1fr; }
  .auth { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  body.in-cm .chat-fab { display: none; }
}

/* ===== Amsawal – chat rooms ===== */
.am-rooms { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.am-rooms a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.am-rooms a.on, .am-rooms a:hover { border-color: var(--brand); color: var(--ink); background: var(--brand-soft); }
.am-rooms small { background: var(--paper); border-radius: 999px; padding: 0 6px; font-size: 11px; }
.am-thread { height: calc(100vh - 220px); min-height: 380px; }
.am-msg { display: flex; gap: 8px; align-items: flex-start; }
.am-msg .am-b { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 7px 12px; max-width: 82%; min-width: 0; }
.am-msg.me .am-b { background: var(--brand-soft); }
.am-h { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.am-h a { font-weight: 700; text-decoration: none; color: var(--ink); }
.am-t { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.am-acts { display: flex; gap: 6px; margin-top: 4px; }
.am-acts button { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.am-acts button:hover { background: var(--paper); color: var(--hot); }
.am-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); border: 1px solid var(--brand); border-radius: 999px; padding: 0 6px; }
.am-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.am-form textarea, .am-form .input { flex: 1; resize: none; min-height: 42px; }
.am-muted { padding: 12px; border-top: 1px solid var(--line); text-align: center; }
.am-sugg { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.am-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .am-thread { height: calc(100vh - 260px); } }
