/* RICHGRAM - unified UI (Phase A). No framework, no CDN. Brand colours come from Admin via --rg-primary / --rg-accent. */
:root {
  --rg-bg: #0b0b10; --rg-surface: #14141c; --rg-surface-2: #1d1d28; --rg-border: rgba(255,255,255,.09);
  --rg-text: #f4f4f8; --rg-muted: #9a9ab0; --rg-danger: #ff5d73; --rg-ok: #3ddc97; --rg-warn: #f5b942;
  --rg-top-h: 56px; --rg-bottom-h: 62px; --rg-radius: 16px;
}
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body.rg-body { margin: 0; background: var(--rg-bg); color: var(--rg-text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.rg-ic { width: 24px; height: 24px; flex: none; }
.rg-h1 { font-size: 24px; line-height: 1.2; margin: 0 0 16px; font-weight: 800; }
.rg-h2 { font-size: 16px; margin: 22px 0 10px; font-weight: 700; color: var(--rg-muted); }
.rg-text { color: #cfcfdd; margin: 0 0 12px; }
.rg-hint { color: var(--rg-muted); font-size: 13px; margin: 6px 0 0; }
.rg-error { color: var(--rg-danger); font-size: 13px; margin: 6px 0 0; }
.rg-pre { background: var(--rg-surface-2); padding: 10px; border-radius: 10px; overflow: auto; font-size: 12px; }

/* ----- top bar ----- */
.rg-topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: calc(var(--rg-top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; background: rgba(11,11,16,.92);
  border-bottom: 1px solid var(--rg-border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.rg-logo { text-decoration: none; display: inline-flex; align-items: center; }
.rg-logo img { height: 30px; width: auto; }
.rg-logo-text { font-weight: 800; font-size: 21px; letter-spacing: .5px; background: linear-gradient(135deg, var(--rg-primary), var(--rg-accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rg-topbar-actions { display: flex; align-items: center; gap: 8px; }
.rg-icon-btn, .rg-avatar-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; background: var(--rg-surface-2); display: grid; place-items: center; text-decoration: none; }
.rg-avatar-btn { padding: 0; overflow: hidden; }
.rg-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.rg-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rg-accent); color: #fff; font: 700 11px/18px system-ui; text-align: center; font-style: normal; }
.rg-badge-inline { position: static; margin-left: auto; }

/* ----- layout ----- */
.rg-shell { display: flex; justify-content: center; gap: 24px; padding: 0 12px; }
.rg-sidebar { display: none; width: 250px; flex: none; position: sticky; top: calc(var(--rg-top-h) + 12px); align-self: flex-start; padding: 12px 0; }
.rg-main { width: 100%; max-width: 680px; min-width: 0; padding: 16px 0 calc(var(--rg-bottom-h) + 24px + env(safe-area-inset-bottom)); }
.rg-side-link { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: #d6d6e4; font-weight: 600; }
.rg-side-link:hover { background: var(--rg-surface-2); }
.rg-side-link.is-active { background: var(--rg-surface-2); color: #fff; }
.rg-side-link.is-active .rg-ic { color: var(--rg-primary); }

/* ----- bottom nav (mobile) ----- */
.rg-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: space-around;
  height: calc(var(--rg-bottom-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); background: rgba(11,11,16,.96);
  border-top: 1px solid var(--rg-border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.rg-bottom-link { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--rg-muted); font-size: 11px; font-weight: 600; min-height: 48px; }
.rg-bottom-link.is-active { color: #fff; }
.rg-bottom-link.is-active .rg-ic { color: var(--rg-primary); }
.rg-bottom-ic { position: relative; display: grid; place-items: center; }
.rg-bottom-link.is-create .rg-bottom-ic { width: 46px; height: 34px; border-radius: 12px; background: linear-gradient(135deg, var(--rg-primary), var(--rg-accent)); color: #fff; }
.rg-bottom-link.is-create .rg-ic { color: #fff; }

@media (min-width: 900px) {
  .rg-sidebar { display: block; }
  .rg-bottom { display: none; }
  .rg-main { padding-bottom: 40px; }
}

/* ----- components ----- */
.rg-card { background: var(--rg-surface); border: 1px solid var(--rg-border); border-radius: var(--rg-radius); padding: 18px; }
.rg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--rg-primary), var(--rg-accent)); color: #fff; font: 700 15px/1 inherit; text-decoration: none; }
.rg-btn:active { transform: scale(.98); }
.rg-btn-ghost { background: var(--rg-surface-2); color: var(--rg-text); border: 1px solid var(--rg-border); }
.rg-btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.rg-btn-block { width: 100%; }
.rg-alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.rg-alert a { text-decoration: underline; font-weight: 700; }
.rg-alert-ok { background: rgba(61,220,151,.12); border-color: rgba(61,220,151,.35); }
.rg-alert-warn { background: rgba(245,185,66,.12); border-color: rgba(245,185,66,.35); }
.rg-alert-bad { background: rgba(255,93,115,.12); border-color: rgba(255,93,115,.35); }
.rg-divider { height: 1px; background: var(--rg-border); margin: 18px 0; position: relative; }
.rg-divider span { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: var(--rg-surface); padding: 0 10px; color: var(--rg-muted); font-size: 13px; }
.rg-link-center { display: block; text-align: center; color: var(--rg-primary); font-weight: 700; text-decoration: none; }
.rg-row-end { text-align: right; margin: 8px 0 14px; font-size: 14px; }
.rg-row-end a { color: var(--rg-primary); text-decoration: none; }
.rg-empty { text-align: center; padding: 34px 20px; }

/* ----- forms ----- */
.rg-form { display: block; }
.rg-label { display: block; font-size: 13px; font-weight: 700; color: #cfcfdd; margin: 14px 0 6px; }
.rg-field { width: 100%; min-height: 46px; padding: 10px 14px; background: var(--rg-surface-2); color: var(--rg-text); border: 1px solid var(--rg-border); border-radius: 12px; font: inherit; }
.rg-field:focus { outline: 2px solid var(--rg-primary); outline-offset: 0; border-color: transparent; }
.rg-field.has-error { border-color: var(--rg-danger); }
.rg-form .rg-btn-block, .rg-form > .rg-two:last-child, .rg-form > .rg-chips + .rg-btn { margin-top: 18px; }
.rg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rg-three { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 8px; }
.rg-prefix { display: flex; align-items: center; background: var(--rg-surface-2); border: 1px solid var(--rg-border); border-radius: 12px; padding-left: 14px; color: var(--rg-muted); }
.rg-prefix .rg-field { border: 0; background: transparent; padding-left: 6px; }
.rg-prefix:focus-within { outline: 2px solid var(--rg-primary); }
.rg-prefix .rg-field:focus { outline: 0; }
.rg-pass { position: relative; }
.rg-pass .rg-field { padding-right: 64px; }
.rg-pass-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--rg-primary); font-weight: 700; cursor: pointer; padding: 8px; }
.rg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rg-chip { background: var(--rg-surface-2); border: 1px solid var(--rg-border); color: var(--rg-text); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.rg-chip:hover { border-color: var(--rg-primary); }
.rg-radios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rg-radio { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border: 1px solid var(--rg-border); border-radius: 12px; background: var(--rg-surface-2); cursor: pointer; font-size: 14px; }
.rg-radio input { accent-color: var(--rg-primary); }
.rg-check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 4px; font-size: 14px; color: #cfcfdd; }
.rg-check input { margin-top: 3px; accent-color: var(--rg-primary); width: 18px; height: 18px; }
.rg-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.rg-tab input { position: absolute; opacity: 0; pointer-events: none; }
.rg-tab span { display: block; text-align: center; padding: 11px 8px; border-radius: 12px; border: 1px solid var(--rg-border); background: var(--rg-surface-2); font-weight: 700; font-size: 14px; cursor: pointer; }
.rg-tab input:checked + span { border-color: var(--rg-primary); background: rgba(139,92,246,.16); }
.rg-tab em { display: block; font-style: normal; font-size: 11px; color: var(--rg-ok); font-weight: 600; }
.rg-google { display: flex; justify-content: center; min-height: 44px; }

/* ----- steps ----- */
.rg-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.rg-step { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rg-muted); font-weight: 600; }
.rg-step b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--rg-surface-2); font-size: 12px; }
.rg-step.is-current { color: #fff; }
.rg-step.is-current b { background: linear-gradient(135deg, var(--rg-primary), var(--rg-accent)); }
.rg-step.is-done b { background: var(--rg-ok); color: #06251a; }

/* ----- auth pages ----- */
.rg-auth-body { min-height: 100vh; }
.rg-auth-wrap { max-width: 440px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 16px 40px; }
.rg-auth-logo { display: block; text-align: center; text-decoration: none; }
.rg-auth-logo .rg-logo-text { font-size: 34px; }
.rg-auth-logo img { height: 44px; margin: 0 auto; }
.rg-auth-tagline { text-align: center; color: var(--rg-muted); margin: 4px 0 22px; }
.rg-auth-card { padding: 22px 20px; }

/* ----- home ----- */
.rg-tabbar { display: flex; gap: 6px; margin-bottom: 14px; }
.rg-tabbar-link { padding: 9px 16px; border-radius: 999px; background: var(--rg-surface-2); text-decoration: none; font-weight: 700; font-size: 14px; color: var(--rg-muted); }
.rg-tabbar-link.is-active { background: linear-gradient(135deg, var(--rg-primary), var(--rg-accent)); color: #fff; }
.rg-video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .rg-video-grid { grid-template-columns: repeat(3, 1fr); } }
.rg-vcard { display: block; text-decoration: none; background: var(--rg-surface); border: 1px solid var(--rg-border); border-radius: 14px; overflow: hidden; }
.rg-vthumb { position: relative; display: block; aspect-ratio: 9 / 14; background: linear-gradient(160deg, var(--rg-surface-2), #101018) center / cover no-repeat; }
.rg-vplay { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: rgba(0,0,0,.55); }
.rg-tag { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.65); font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 3px 7px; border-radius: 6px; text-transform: uppercase; }
.rg-vmeta { display: flex; gap: 8px; padding: 10px; }
.rg-vmeta img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.rg-vtext { min-width: 0; display: block; }
.rg-vtext b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-vtext small { display: block; color: var(--rg-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-pager { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }

/* ----- menu page ----- */
.rg-profile-card { display: flex; align-items: center; gap: 14px; text-decoration: none; margin-bottom: 14px; }
.rg-profile-card img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.rg-profile-card b { display: block; font-size: 16px; }
.rg-profile-card small { color: var(--rg-muted); }
.rg-menu-search { margin-bottom: 4px; }
.rg-menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .rg-menu-grid { grid-template-columns: repeat(3, 1fr); } }
.rg-menu-item { display: flex; flex-direction: column; gap: 10px; padding: 14px; text-decoration: none; background: var(--rg-surface); border: 1px solid var(--rg-border); border-radius: 14px; min-height: 84px; }
.rg-menu-item:hover { border-color: var(--rg-primary); }
.rg-menu-item b { font-size: 14px; }
.rg-menu-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--rg-primary), var(--rg-accent)); color: #fff; }
.rg-menu-ic .rg-ic { width: 20px; height: 20px; }
.rg-logout { margin-top: 24px; }
[hidden] { display: none !important; }
