.mdrawer { position: fixed; inset: 0; z-index: 1400; }
.mdrawer[hidden] { display: none; }
@media (min-width: 992px) { .mdrawer { display: none !important; } }

.mdrawer__backdrop {
    position: absolute; inset: 0; opacity: 0;
    background: rgba(25, 10, 8, .5);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    transition: opacity .3s ease;
}
.mdrawer__sheet {
    position: absolute; left: 0; right: 0; bottom: 0;
    max-height: 90dvh; display: flex; flex-direction: column;
    background: var(--bg-page, var(--bg-surface));
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 40px rgba(0,0,0,.22);
    transform: translateY(100%);
    transition: transform .45s cubic-bezier(.32, .72, 0, 1);
    font-family: var(--font-sans);
}
.mdrawer.is-open .mdrawer__backdrop { opacity: 1; }
.mdrawer.is-open .mdrawer__sheet { transform: none; }
.mdrawer__sheet.is-dragging { transition: none; }

.mdrawer__grab { padding: 10px 0 0; display: grid; place-items: center; touch-action: none; }
.mdrawer__grab span { width: 40px; height: 4px; border-radius: 4px; background: var(--border-color); }

.mdrawer__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 10px; touch-action: none; }
.mdrawer__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mdrawer__brand span { font-family: var(--font-heading); font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em; color: var(--text-main); }
.mdrawer__head-actions { display: flex; gap: 8px; }
.mdrawer__icon-btn {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-main);
    font-size: 1.15rem; cursor: pointer; padding: 0; transition: transform .2s;
}
.mdrawer__icon-btn:active { transform: scale(.92); }

.mdrawer__body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px calc(28px + env(safe-area-inset-bottom, 0px)); }

/* Account */
.mdrawer__account { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 18px; padding: 14px; }
.mdrawer__user { display: flex; align-items: center; gap: 12px; }
.mdrawer__avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; flex-shrink: 0; }
.mdrawer__user-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.mdrawer__user-text strong { font-size: .95rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mdrawer__user-text span { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mdrawer__signout { color: #DC2626; font-size: 1.25rem; padding: 6px; }
.mdrawer__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mdrawer__chips a { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600; text-decoration: none; color: var(--text-main); background: var(--bg-subtle); border: 1px solid var(--border-color); }
.mdrawer__chips a.is-strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.mdrawer__guest { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mdrawer__guest div { display: flex; flex-direction: column; }
.mdrawer__guest strong { font-family: var(--font-heading); font-size: 1.02rem; color: var(--text-main); }
.mdrawer__guest span { font-size: .75rem; color: var(--text-muted); }
.mdrawer__signin { background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; padding: 9px 18px; border-radius: 999px; text-decoration: none; white-space: nowrap; }

/* Search */
.mdrawer__search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; margin-top: 12px; border-radius: 14px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-muted); }
.mdrawer__search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: .92rem; color: var(--text-main); }
.mdrawer__search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,46,39,.14); }

/* Labels */
.mdrawer__label { margin: 22px 2px 10px; font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }

/* Tiles */
.mdrawer__tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mdrawer__tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 10px; border-radius: 16px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); text-decoration: none; font-size: .74rem; font-weight: 600; transition: transform .15s, background .2s, color .2s; }
.mdrawer__tile i { font-size: 1.4rem; color: var(--accent); transition: color .2s; }
.mdrawer__tile .is-bn { font-family: 'Noto Serif Bengali', serif; font-weight: 700; }
.mdrawer__tile:active { transform: scale(.94); }
.mdrawer__tile.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mdrawer__tile.is-active i { color: #fff; }

/* Accordions */
.mdrawer__acc-group { margin-top: 14px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; }
.md-acc + .md-acc { border-top: 1px solid var(--border-color); }
.md-acc__btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: none; border: 0; color: var(--text-main); font: inherit; font-size: .92rem; font-weight: 600; text-align: left; cursor: pointer; }
.md-acc__btn > i:first-child { font-size: 1.15rem; color: var(--accent); }
.md-acc__btn span { flex: 1; }
.md-acc__chev { font-size: 1.3rem; color: var(--text-muted); transition: transform .3s ease; }
.md-acc.is-open .md-acc__chev { transform: rotate(180deg); }
.md-acc__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s cubic-bezier(.32,.72,0,1); }
.md-acc.is-open .md-acc__panel { grid-template-rows: 1fr; }
.md-acc__inner { overflow: hidden; display: flex; flex-direction: column; padding: 0 16px 0 44px; }
.md-acc.is-open .md-acc__inner { padding-bottom: 10px; }
.md-acc__inner a { padding: 10px 0; font-size: .88rem; color: var(--text-muted); text-decoration: none; border-top: 1px solid var(--border-color); transition: color .15s, padding-left .2s; }
.md-acc__inner a:first-child { border-top: 0; }
.md-acc__inner a:active { color: var(--accent); padding-left: 6px; }

/* Contribute cards */
.mdrawer__cards { display: flex; flex-direction: column; gap: 8px; }
.mdrawer__card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); text-decoration: none; transition: transform .15s; }
.mdrawer__card:active { transform: scale(.98); }
.mdrawer__card > i:first-child { font-size: 1.25rem; color: var(--accent); }
.mdrawer__card > i:last-child { color: var(--text-muted); }
.mdrawer__card div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mdrawer__card strong { font-size: .88rem; font-weight: 700; line-height: 1.3; }
.mdrawer__card small { font-size: .72rem; color: var(--text-muted); }
.mdrawer__card .is-bn { font-family: 'Noto Serif Bengali', serif; }
.mdrawer__card.is-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mdrawer__card.is-primary > i, .mdrawer__card.is-primary small { color: rgba(255,255,255,.85); }

.mdrawer__donate { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; padding: 12px; border-radius: 14px; font-weight: 700; font-size: .88rem; text-decoration: none; color: #B45309; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); }

/* Footer block */
.mdrawer__foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-color); text-align: center; }
.mdrawer__legal { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; }
.mdrawer__legal a { font-size: .78rem; color: var(--text-muted); text-decoration: none; }
.mdrawer__foot p { margin: 4px 0 0; font-size: .7rem; color: var(--text-subtle, var(--text-muted)); line-height: 1.5; }

/* Staggered entrance */
.mdrawer [style*="--i"] { opacity: 0; transform: translateY(14px); }
.mdrawer.is-open [style*="--i"] { animation: mdIn .5s cubic-bezier(.22,1,.36,1) forwards; animation-delay: calc(.1s + var(--i) * 35ms); }
@keyframes mdIn { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .mdrawer__sheet, .mdrawer__backdrop, .md-acc__panel, .md-acc__chev { transition: none; }
    .mdrawer [style*="--i"] { opacity: 1; transform: none; animation: none !important; }
}
/* 1. Logo sizing */
.mdrawer__brand img { height: 30px; width: auto; max-width: none; flex-shrink: 0; display: block; }
.mdrawer__brand { min-width: 0; }

/* 2. Sit above the dock, chatbot and other fixed UI */
.mdrawer { z-index: 100000; }

/* 3. Softer focus ring that matches the palette */
.mdrawer__icon-btn:focus { outline: none; }
.mdrawer__icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Optional polish: hairline under the header so the body scrolls beneath it */
.mdrawer__head { border-bottom: 1px solid var(--border-color); padding-bottom: 12px; }
.mdrawer__body { padding-top: 14px; }