/* Mobile master view (components/master/mobile.py + ms_mobile.js). Every rule starts with #msm_root. Same look as
   the mobile app shell (assets/mobile/mb_style.css): its tokens, 44px touch targets, safe-area insets, bottom nav,
   no horizontal scroll at 360-430px. */

#msm_root {
    --mb-panel: rgba(0, 0, 0, .55); --mb-chip: rgba(255, 255, 255, .06); --mb-line: rgba(255, 255, 255, .09);
    --mb-text: #e8e8e8; --mb-muted: #9fb3c8; --mb-head: #cfefff; --mb-acc: #f0a030; --mb-glow: #4be9fa;
    --mb-good: #3fbf7f; --mb-bad: #e66767; --mb-warn: #fab219;
    --mb-bg: linear-gradient(160deg, #010304 8%, #04161c 48%, #0a4c55 100%);
    position: fixed; inset: 0; z-index: 1001; display: flex; flex-direction: column; overflow: hidden; overflow: clip;
    background: #020507; background-image: var(--mb-bg); color: var(--mb-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.4;
    -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
#msm_root *, #msm_root *::before, #msm_root *::after { box-sizing: border-box; }
#msm_root button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
#msm_root button:focus-visible, #msm_root textarea:focus-visible, #msm_root summary:focus-visible { outline: 2px solid var(--mb-glow); outline-offset: 2px; }

/* header */
#msm_root .msm-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
                      padding: calc(10px + env(safe-area-inset-top)) 12px 8px 16px; }
#msm_root .msm-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
#msm_root .msm-logo { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
                      color: var(--mb-acc); font-size: 1.1rem; background: rgba(240,160,48,.10); border: 1px solid rgba(240,160,48,.45); }
#msm_root .msm-t { font-size: 1.12rem; font-weight: 650; color: var(--mb-head); }
#msm_root .msm-ib { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
                    background: transparent; border: 0; color: var(--mb-head); font-size: 1.05rem; }
#msm_root .msm-ib:active { background: var(--mb-chip); }

/* views */
#msm_root .msm-scroll { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain;
                        -webkit-overflow-scrolling: touch; padding: 2px 16px calc(84px + env(safe-area-inset-bottom)); }
#msm_root .msm-view { display: none; }
#msm_root[data-view="highlights"] #msm_v_highlights, #msm_root[data-view="requests"] #msm_v_requests,
#msm_root[data-view="users"] #msm_v_users, #msm_root[data-view="account"] #msm_v_account { display: block; animation: msm-in .22s ease-out; }
@keyframes msm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#msm_root .msm-h2 { font-size: 1.35rem; font-weight: 650; color: var(--mb-head); margin: 6px 0 10px; }
#msm_root .msm-h3 { margin: 16px 0 8px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mb-muted); font-weight: 650; }
#msm_root .msm-card .msm-h3 { margin: 10px 0 6px; }
#msm_root .msm-sub { color: var(--mb-muted); font-size: .76rem; line-height: 1.4; margin-top: 2px; overflow-wrap: anywhere; }
#msm_root .msm-sub i { font-size: .7rem; margin-right: 2px; }
#msm_root .msm-mut { color: var(--mb-muted); font-weight: 400; }
#msm_root .msm-empty { color: var(--mb-muted); font-size: .82rem; padding: 12px; border: 1px dashed rgba(255,255,255,.14); border-radius: 14px; text-align: center; }
#msm_root .msm-wait { display: flex; align-items: center; gap: 10px; color: var(--mb-muted); font-size: .82rem; padding: 14px 2px; }
#msm_root .msm-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--mb-acc);
                      animation: msm-spin .8s linear infinite; }
@keyframes msm-spin { to { transform: rotate(360deg); } }
#msm_root .msm-foot { color: #7f93a8; font-size: .72rem; line-height: 1.45; margin-top: 14px; }
#msm_root .msm-foot a { color: var(--mb-muted); }
#msm_root .msm-foot code { color: #cfdcea; }

/* cards + tiles */
#msm_root .msm-card { background: var(--mb-panel); border: 1px solid var(--mb-line); border-radius: 16px; padding: 12px 14px; margin: 0 0 12px; }
#msm_root .msm-card.hero { background: linear-gradient(160deg, rgba(240,160,48,.12), rgba(0,0,0,.55) 60%); border-color: rgba(240,160,48,.35); }
#msm_root .msm-card-t { display: flex; align-items: center; gap: 8px; color: var(--mb-head); font-weight: 650; font-size: .95rem; }
#msm_root .msm-card-t i { color: var(--mb-acc); font-size: .85rem; width: 16px; text-align: center; }
#msm_root .msm-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
#msm_root .msm-tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#msm_root .msm-tiles.one { grid-template-columns: minmax(0, 1fr); }
#msm_root .msm-tile { min-width: 0; padding: 8px 10px; border-radius: 12px; background: var(--mb-chip); }
#msm_root .msm-v { color: var(--mb-head); font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums;
                   white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#msm_root .msm-card.hero .msm-v { font-size: 1.8rem; }
#msm_root .msm-v.good { color: var(--mb-good); } #msm_root .msm-v.bad { color: #ff9b91; }
#msm_root .msm-v.warn { color: var(--mb-warn); } #msm_root .msm-v.acc { color: var(--mb-acc); }
#msm_root .msm-l { color: var(--mb-muted); font-size: .68rem; line-height: 1.25; margin-top: 2px; }
#msm_root .msm-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 4px 0 -8px; padding: 0;
                      background: none; border: 0; color: var(--mb-acc); font-size: .84rem; font-weight: 650; }
#msm_root .msm-link i { font-size: .7rem; }

/* chips */
#msm_root .msm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#msm_root .msm-chip { display: inline-block; flex: 0 0 auto; padding: 1px 8px; border-radius: 10px; font-size: .68rem; font-weight: 600;
                      line-height: 1.6; white-space: nowrap; border: 1px solid; color: var(--mb-muted); }
#msm_root .msm-chip.good { color: var(--mb-good); } #msm_root .msm-chip.bad { color: #ff9b91; }
#msm_root .msm-chip.warn { color: var(--mb-warn); } #msm_root .msm-chip.acc { color: var(--mb-acc); }
#msm_root .msm-chip.mut { color: var(--mb-muted); border-color: rgba(159,179,200,.4); }

/* rows / lists */
#msm_root .msm-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
#msm_root .msm-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.035); }
#msm_root .msm-row.user { background: var(--mb-panel); border: 1px solid var(--mb-line); padding: 10px 12px; }
#msm_root .msm-rb { flex: 1 1 auto; min-width: 0; }
#msm_root .msm-rt { color: var(--mb-head); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#msm_root .msm-rt .msm-chip { margin-left: 6px; vertical-align: 1px; }
#msm_root .msm-code { font-family: ui-monospace, Consolas, monospace; font-size: .72rem; color: #cfdcea; overflow-wrap: anywhere; }
#msm_root .msm-av { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
                    font-weight: 700; color: var(--mb-head); background: linear-gradient(135deg, rgba(11,95,105,.9), rgba(75,233,250,.18));
                    border: 1px solid rgba(75,233,250,.35); }
#msm_root .msm-av.big { flex-basis: 60px; width: 60px; height: 60px; font-size: 1.4rem; }

/* request cards */
#msm_root .msm-rq { display: block; width: 100%; text-align: left; color: var(--mb-text); padding: 12px; border-radius: 16px; background: var(--mb-panel); border: 1px solid var(--mb-line); cursor: pointer;
                    transition: transform .15s ease, border-color .15s ease; }
#msm_root .msm-rq.pending { border-color: rgba(240,160,48,.45); }
#msm_root .msm-rq.expired { opacity: .7; }
#msm_root .msm-rq:active { transform: scale(.985); }
#msm_root .msm-rq-h { display: flex; align-items: flex-start; gap: 10px; }

/* the request sheet */
#msm_root .msm-sheet { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; background: #020507; background-image: var(--mb-bg);
                       transform: translateX(100%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s linear .28s; }
#msm_root.msm-sheet-on .msm-sheet { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s; }
#msm_root.msm-sheet-on .msm-nav { transform: translateY(110%); }
#msm_root .msm-sheetbar { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px;
                          background: rgba(5,11,15,.9); border-bottom: 1px solid var(--mb-line); }
#msm_root .msm-sheet-t { color: var(--mb-head); font-weight: 650; }
#msm_root .msm-sheet-body { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain;
                            padding: 12px 16px calc(28px + env(safe-area-inset-bottom)); }
#msm_root .msm-sheet-busy { display: none; position: absolute; inset: 0; align-items: flex-start; justify-content: center; padding-top: 40px;
                            background: rgba(2,6,9,.85); }
#msm_root.msm-busy .msm-sheet-busy { display: flex; }
#msm_root .msm-dhero { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
#msm_root .msm-dname { color: var(--mb-head); font-size: 1.15rem; font-weight: 650; overflow-wrap: anywhere; }
#msm_root .msm-dtable { padding: 4px 14px; }
#msm_root .msm-drow { padding: 8px 0; border-bottom: 1px solid var(--mb-line); }
#msm_root .msm-drow:last-child { border-bottom: 0; }
#msm_root .msm-dk { color: var(--mb-muted); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
#msm_root .msm-dv { color: var(--mb-text); font-size: .86rem; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
#msm_root .msm-in { width: 100%; min-height: 60px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--mb-line);
                    background: rgba(255,255,255,.05); color: var(--mb-text); font-size: 16px; color-scheme: dark; resize: vertical; }
#msm_root .msm-in:focus { border-color: rgba(240,160,48,.7); outline: none; }
#msm_root .msm-confirm { margin-top: 10px; border-radius: 14px; border: 1px solid var(--mb-line); background: var(--mb-panel); }
#msm_root .msm-confirm summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px;
                                 font-weight: 650; cursor: pointer; }
#msm_root .msm-confirm summary::-webkit-details-marker { display: none; }
#msm_root .msm-confirm.good summary { color: var(--mb-good); }
#msm_root .msm-confirm.bad summary { color: #ff9b91; }
#msm_root .msm-confirm[open].good { border-color: rgba(63,191,127,.55); }
#msm_root .msm-confirm[open].bad { border-color: rgba(230,103,103,.55); }
#msm_root .msm-confirm-b { padding: 0 14px 14px; }
#msm_root .msm-btn { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px;
                     border-radius: 12px; font-weight: 650; font-size: .9rem; color: #f5d6a3; background: rgba(240,160,48,.14);
                     border: 1px solid rgba(240,160,48,.6); }
#msm_root .msm-btn.good { color: #d4f5e2; background: rgba(63,191,127,.16); border-color: rgba(63,191,127,.7); }
#msm_root .msm-btn.bad { color: #ffd0cb; background: rgba(230,103,103,.10); border-color: rgba(230,103,103,.5); }
#msm_root .msm-flash { padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; font-size: .84rem; line-height: 1.45; }
#msm_root .msm-flash.good { color: #d4f5e2; background: rgba(63,191,127,.12); border: 1px solid rgba(63,191,127,.5); }
#msm_root .msm-flash.bad { color: #ffd0cb; background: rgba(230,103,103,.10); border: 1px solid rgba(230,103,103,.5); }

/* bottom navigation */
#msm_root .msm-nav { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; padding: 0 4px env(safe-area-inset-bottom);
                     background: rgba(5,11,15,.94); border-top: 1px solid var(--mb-line); -webkit-backdrop-filter: blur(10px);
                     backdrop-filter: blur(10px); transition: transform .25s ease; }
#msm_root .msm-navb { flex: 1 1 0; min-width: 0; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center;
                      gap: 4px; padding: 6px 2px; background: none; border: 0; color: var(--mb-muted); font-size: .68rem; font-weight: 600; position: relative; }
#msm_root .msm-navb i { font-size: 1.15rem; }
#msm_root .msm-navb.on { color: var(--mb-acc); }
#msm_root .msm-navb.on::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--mb-acc); }
#msm_root .msm-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
                       font-size: .66rem; line-height: 18px; text-align: center; color: #1b1205; background: var(--mb-acc); }
#msm_root .msm-badge:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
    #msm_root *, #msm_root *::before, #msm_root *::after { animation: none !important; transition: none !important; }
}

/* ---- one-time codes (2026-10-05): the email cells (ms-mail*, master.css) inside the sheet, password recovery,
        the notifications switch ---- */
#msm_root .msm-mailcard { border-color: rgba(240,160,48,.5); }
#msm_root .msm-mailcard .ms-mail { margin-top: 10px; gap: 10px; }
#msm_root .ms-mail-note { font-size: .8rem; line-height: 1.45; }
#msm_root .ms-mail-warn { font-size: .84rem; border-radius: 12px; }
#msm_root .ms-mail-cell { border-radius: 14px; }
#msm_root .ms-mail-h { padding: 6px 8px 6px 12px; }
#msm_root .ms-mail-k { font-size: .68rem; }
#msm_root .ms-mail-copy { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: .84rem; }
#msm_root .ms-mail-v { padding: 10px 12px; font-size: .9rem; }
#msm_root .ms-mail-v.body { max-height: 46vh; font-size: .86rem; }
#msm_root .ms-mail-v.code { font-size: 1.5rem; }
#msm_root .ms-mail-foot { flex-direction: column; }
#msm_root .ms-mail-foot .ms-mail-cell { flex: 0 0 auto; }
#msm_root .ms-mail-open { min-height: 48px; border-radius: 14px; font-size: .92rem; }
#msm_root .msm-codestate { margin: 0 0 10px; }
#msm_root .msm-rq.awaiting_code, #msm_root .msm-rq.code_sent { border-color: rgba(250,178,25,.4); }
#msm_root .msm-rq.open { border-color: rgba(240,160,48,.45); }
#msm_root .msm-rc-new { margin-top: 10px; }
#msm_root .msm-rc-new .msm-btn { color: var(--mb-head); background: var(--mb-chip); border: 1px solid var(--mb-line); }
#msm_root .msm-dd { margin-top: 10px; font-size: 16px; /* no zoom on focus (iOS) */ }
#msm_root .msm-dd .Select-control { min-height: 46px; border-radius: 12px; background: rgba(255,255,255,.06) !important; border-color: var(--mb-line) !important; }
#msm_root .msm-dd .Select-value, #msm_root .msm-dd .Select-placeholder { line-height: 44px !important; }
#msm_root .msm-dd .Select-input { height: 44px; }
#msm_root .msm-dd .Select-value-label, #msm_root .msm-dd .Select-placeholder, #msm_root .msm-dd input { color: var(--mb-text) !important; }
#msm_root .msm-dd .Select-menu-outer, #msm_root .msm-dd .Select-menu { background: #0b1a20 !important; color: var(--mb-text); border-color: var(--mb-line); }
#msm_root .msm-dd .VirtualizedSelectOption { color: var(--mb-text); }
#msm_root .msm-dd .VirtualizedSelectFocusedOption { background: rgba(240,160,48,.2) !important; }
#msm_root .ms-push-status { font-size: .88rem; margin-top: 8px; }
#msm_root .ms-push-btns { flex-direction: column; gap: 0; }
#msm_root .ms-push .msm-btn { color: var(--mb-head); background: var(--mb-chip); border: 1px solid var(--mb-line); }
#msm_root .ms-push[data-ms-push-state="off"] .ms-push-on { display: flex; color: #1b1205; background: var(--mb-acc); border-color: var(--mb-acc); }
#msm_root .ms-push[data-ms-push-state="on"] .ms-push-off, #msm_root .ms-push[data-ms-push-state="on"] .ms-push-test { display: flex; }
