/* Groups: list cards, group page with banner and logo, chat with channels, members and settings. Dark, borderless like clean.css. */
.g-search { display: flex; align-items: center; gap: 9px; max-width: 420px; margin: 0 0 22px; padding: 11px 15px; border-radius: 999px; background: var(--surface, #201a23); color: var(--muted); }
.g-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 13px; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 30px; }
.g-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; padding: 0; border: 0; border-radius: 16px; background: var(--surface, #201a23); color: var(--ink); text-align: left; transition: background .15s, transform .15s; }
.g-card:hover { background: var(--surface-hover, #2c2530); transform: translateY(-2px); }
.g-card-banner { display: block; height: 84px; background: linear-gradient(135deg, #3d3641, #302933); overflow: hidden; }
.g-card-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-card-body { display: flex; align-items: flex-end; gap: 11px; margin: -26px 14px 0; }
.g-card-text { min-width: 0; padding-bottom: 2px; }
.g-card-text strong { display: block; font: 800 15px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-card-text small { color: var(--muted); font-size: 11px; }
.g-card-desc { margin: 10px 14px 0; color: var(--muted); font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.g-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 14px 14px; }
.g-chip { padding: 3px 8px; border-radius: 999px; background: #332c37; color: #d7c9d5; font-size: 10px; font-weight: 800; white-space: nowrap; }
.g-chip.role-owner { background: #3b3216; color: #ffd66b; }
.g-chip.role-admin { background: #3a333e; color: #cbb4ff; }
.g-chip.role-moderator { background: #163a35; color: #7ff0d2; }
.g-logo { flex: none; display: grid; place-items: center; border-radius: 22%; object-fit: cover; background: #37303b; border: 3px solid var(--surface, #201a23); color: #ff9e57; font: 800 22px var(--font); }
.g-card .g-logo { width: 52px; height: 52px; }
.g-logo-empty { background: linear-gradient(135deg, #534852, #3e3742); }

.g-page { min-width: 0; }
.g-back { padding: 0; margin-bottom: 12px; }
.g-head { overflow: hidden; border-radius: 20px; background: var(--surface, #201a23); margin-bottom: 16px; }
.g-banner { aspect-ratio: 3 / 1; max-height: 240px; width: 100%; background: linear-gradient(135deg, #3d3641, #302933); overflow: hidden; }
.g-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-head-row { display: flex; align-items: flex-start; gap: 16px; margin: 0 20px; flex-wrap: wrap; }
.g-banner.empty { aspect-ratio: auto; height: 110px; }
.g-head .g-logo { width: 96px; height: 96px; font-size: 38px; border-width: 4px; margin-top: -48px; }
.g-head-text { flex: 1; min-width: 200px; padding-top: 14px; }
.g-head-text h1 { margin: 0 0 6px; font: 800 26px/1.15 var(--font); letter-spacing: -.8px; overflow-wrap: anywhere; }
.g-head-text .g-chips { margin: 0; }
.g-head-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.g-desc { margin: 14px 20px 18px; color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.g-head-row + .g-desc { margin-top: 14px; }
.g-head > :last-child:not(.g-desc) { margin-bottom: 18px; }
.g-desc a, .g-msg-body p a { color: #b9a2ff; text-decoration: underline; }

.g-chat { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; min-height: 520px; }
.g-channels { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 16px; background: var(--surface, #201a23); align-self: start; position: sticky; top: 20px; }
.g-channels-label { margin: 2px 8px 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.g-channels button { display: flex; align-items: baseline; gap: 6px; min-width: 0; border: 0; background: none; padding: 8px 10px; border-radius: 9px; color: #c0b2be; font-size: 13px; font-weight: 700; text-align: left; }
.g-channels button b { font-weight: inherit; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-channels button span { color: #73748e; }
.g-channels button small { margin-left: auto; color: #73748e; font-size: 9px; font-weight: 700; white-space: nowrap; }
.g-channels button:hover { background: var(--surface-hover, #2c2530); color: #ffffff; }
.g-channels button.active { background: #2f2833; color: #ffffff; box-shadow: inset 3px 0 #ff9e57; }
.g-room { display: flex; flex-direction: column; min-width: 0; border-radius: 16px; background: var(--surface, #201a23); overflow: hidden; }
.g-room-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 13px 16px; border-bottom: 1px solid #ffffff0d; }
.g-room-head strong { font-size: 14px; }
.g-room-head span:not(.g-chip) { color: var(--muted); font-size: 12px; }
.g-messages { flex: 1; display: flex; flex-direction: column; gap: 2px; height: clamp(320px, calc(100vh - 430px), 620px); overflow-y: auto; padding: 12px 8px; overscroll-behavior: contain; }
.g-chat-empty { margin: auto; color: var(--muted); font-size: 13px; }
.g-older { align-self: center; margin-bottom: 8px; border: 0; background: #332c37; color: #d7c9d5; border-radius: 999px; padding: 6px 12px; font-size: 11px; font-weight: 800; }
.g-msg { display: flex; gap: 10px; padding: 7px 8px; border-radius: 10px; }
.g-msg:hover { background: #ffffff06; }
.g-msg-body { min-width: 0; flex: 1; }
.g-msg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.g-msg-head a, .g-msg-head strong { color: #f1ebe6; font-weight: 800; }
.g-msg.mine .g-msg-head a, .g-msg.mine .g-msg-head strong { color: #ff9e57; }
.g-msg-head time { color: #73748e; font-size: 10px; }
.g-msg-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.g-msg:hover .g-msg-actions, .g-msg:focus-within .g-msg-actions { opacity: 1; }
.g-msg-actions button { border: 0; background: none; color: #a497a2; padding: 2px 6px; border-radius: 6px; font-size: 11px; }
.g-msg-actions button:hover { background: #332c37; color: #ffffff; }
.g-msg-body p { margin: 3px 0 0; color: #e5d8e4; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.g-face { flex: none; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.g-face-initials { display: grid; place-items: center; background: #423a46; color: #d9ccff; font-size: 11px; font-weight: 800; }
.g-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #ffffff0d; }
.g-composer textarea { flex: 1; min-width: 0; min-height: 42px; max-height: 160px; resize: vertical; border: 1px solid #3e3742; border-radius: 10px; background: #1b161e; color: var(--ink); padding: 10px 12px; font: inherit; font-size: 13px; }
.g-composer textarea:focus { outline: none; border-color: #b28bff; }
.g-composer-note { padding: 14px 16px; border-top: 1px solid #ffffff0d; color: var(--muted); font-size: 12px; }

.g-tabs { margin-bottom: 14px; }
.g-tab-body h3 { margin: 18px 0 10px; font: 800 14px var(--font); }
.g-tab-body > h3:first-child, .g-panel > h3:first-child { margin-top: 0; }
.g-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-member { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface, #201a23); flex-wrap: wrap; }
.g-member .g-face { width: 40px; height: 40px; }
.g-member-name { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; font-size: 13px; }
.g-member-name a, .g-member-name strong { color: var(--ink); font-weight: 800; overflow-wrap: anywhere; }
.g-member-name small { color: var(--muted); font-size: 11px; }
.g-member-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.g-member-actions .btn { min-height: 32px; padding: 6px 10px; }
.g-member-actions select, .g-channel-form select { border: 1px solid #3e3742; border-radius: 9px; background: #1b161e; color: var(--ink); padding: 7px 9px; font-size: 12px; }

.g-panel { padding: 18px; border-radius: 16px; background: var(--surface, #201a23); margin-bottom: 14px; }
.g-panel .g-member { background: #1b161e; }
.g-hint { display: block; margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.g-fieldset { border: 0; padding: 0; margin: 14px 0; display: grid; gap: 6px; }
.g-fieldset legend { font-size: 11px; font-weight: 800; margin-bottom: 6px; }
.g-form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.g-form-row .field { margin: 8px 0; }
.g-form-row select { width: 100%; }
.g-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.g-form-actions .btn.primary { width: auto; margin-top: 0; }
.g-channel-edit { border-radius: 12px; background: #1b161e; margin-bottom: 8px; }
.g-channel-edit summary { cursor: pointer; padding: 12px 14px; font-weight: 800; font-size: 13px; }
.g-channel-edit summary small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.g-channel-form { padding: 0 14px 14px; }
.g-media { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.g-media-preview { flex: none; display: block; overflow: hidden; background: linear-gradient(135deg, #3d3641, #302933); }
.g-media-preview.logo { width: 64px; height: 64px; border-radius: 22%; }
.g-media-preview.banner { width: 150px; height: 50px; border-radius: 10px; }
.g-media-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-media label.btn { cursor: pointer; }
.btn.g-danger { color: #ff8a95; }
.g-danger-zone { box-shadow: inset 0 0 0 1px #ff5e6c33; }
.dialog .g-fieldset .tag-option, .g-panel .tag-option { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }

/* With groups the bottom bar holds nine entries; it scrolls sideways instead of squeezing. */
@media (max-width: 730px) {
  .mobile-nav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .mobile-nav button { flex: 0 0 auto; }
  .g-chat { grid-template-columns: 1fr; min-height: 0; }
  .g-channels { position: static; flex-direction: row; overflow-x: auto; padding: 8px; scrollbar-width: none; }
  .g-channels-label { display: none; }
  .g-channels button { flex: 0 0 auto; }
  .g-messages { height: calc(100dvh - 330px); min-height: 280px; }
  .g-msg-actions { opacity: 1; }
  .g-head-row { margin: 0 14px; gap: 10px 14px; }
  .g-head .g-logo { width: 72px; height: 72px; font-size: 28px; margin-top: -36px; }
  .g-head-text { padding-top: 0; min-width: 100%; order: 1; }
  .g-head-actions { padding-top: 10px; margin-left: auto; }
  .g-head-text h1 { font-size: 22px; }
  .g-desc { margin: 12px 14px 16px; }
  .g-form-row { grid-template-columns: 1fr; }
  .g-grid { grid-template-columns: 1fr; }
}
