/*
 * The site navigation: header (shared/header), side menu (shared/site-drawer) and the tool
 * search popup (shared/search-palette). Loaded by layouts/wrapper before mobile.css.
 */
.mn-svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mn-ink-red { color: var(--ms-red); }
.mn-ink-purple { color: #3a4a5e; }
.mn-ink-green { color: #16a34a; }
.mn-ink-amber { color: #e29a00; }
.mn-ink-orange { color: #f97316; }
.mn-ink-ink { color: var(--ms-ink); }
.mn-new { position: absolute; top: -9px; left: 60%; padding: .1rem .42rem; border-radius: 99px; background: var(--ms-red); color: #fff; font-size: var(--text-2xs); font-style: normal; font-weight: 700; line-height: 1.35; white-space: nowrap; box-shadow: 0 4px 10px rgba(240, 102, 105, .3); }

/* ---- Header ---- */
.mn-header { left: 0; right: 0; }
.mn-bar { display: flex; align-items: center; gap: .9rem; min-height: 74px; }
.mn-icon-btn { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: rgba(13, 34, 55, .1); color: var(--ms-ink); cursor: pointer; transition: background-color .15s, color .15s; }
.mn-icon-btn:hover { background: var(--ms-red-soft); color: var(--ms-red); }
.mn-logo { display: flex; align-items: center; flex-shrink: 0; }
.mn-logo img { height: 36px; width: auto; }
.mn-links { display: flex; align-items: stretch; align-self: stretch; gap: .15rem; margin-left: .8rem; }
.mn-link { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; padding: 0 .85rem; color: var(--ms-ink) !important; font-size: var(--text-base); font-weight: 500; text-decoration: none !important; white-space: nowrap; transition: color .15s; }
.mn-link-icon { position: relative; display: flex; }
.mn-link-crown .mn-svg { color: #f59e0b; }
.mn-link:hover { color: var(--ms-red) !important; }
.mn-link.active { color: var(--ms-red) !important; font-weight: 600; }
.mn-link.active::after { content: ""; position: absolute; left: .55rem; right: .55rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--ms-red); }
.mn-search-btn { display: flex; align-items: center; gap: .6rem; flex: 0 1 270px; min-width: 0; height: 46px; margin-left: auto; padding: 0 .55rem 0 .95rem; border: 1px solid var(--ms-line); border-radius: 6px; background: var(--ms-card); color: var(--ms-muted); font-size: var(--text-lg); box-shadow: 0 4px 14px rgba(13, 34, 55, .05); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.mn-search-btn:hover { border-color: #f4b3b1; box-shadow: 0 0 0 4px rgba(240, 102, 105, .08); }
.mn-search-btn .mn-svg { width: 20px; height: 20px; color: var(--ms-ink); }
.mn-search-btn span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mn-header kbd, .mn-drawer kbd, .mn-palette kbd { padding: .15rem .45rem; border: 1px solid var(--ms-line); border-radius: 6px; background: rgba(13, 34, 55, .1); color: var(--ms-muted); font-family: inherit; font-size: var(--text-sm); font-weight: 600; box-shadow: none; white-space: nowrap; }
.mn-actions { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.mn-search-icon { display: none; }
.mn-burger { display: none; }
.mn-login { display: inline-flex; align-items: center; gap: .5rem; height: 46px; padding: 0 1.3rem; border-radius: 6px; background: linear-gradient(135deg, var(--ms-red), var(--ms-red)); color: #fff !important; font-weight: 600; text-decoration: none !important; box-shadow: 0 8px 20px rgba(240, 102, 105, .3); transition: transform .15s, box-shadow .15s; }
.mn-login:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(240, 102, 105, .38); }
.mn-login .mn-svg { width: 19px; height: 19px; }
.mn-user .ms-user-button { height: 46px; }

@media (max-width: 1199.98px) {
    .mn-link { padding: 0 .6rem; }
    .mn-search-btn kbd { display: none; }
}

@media (max-width: 991.98px) {
    .mn-bar { position: relative; gap: .3rem; min-height: 60px; }
    .mn-links, .mn-search-btn { display: none; }
    .mn-bar > .mn-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
    .mn-actions { margin-left: auto; }
    [dir="rtl"] .mn-actions { margin-left: 0; margin-right: auto; }
    .mn-bar > .mn-logo img { height: 28px; }
    .mn-icon-btn { width: 38px; height: 38px; }
    .mn-icon-btn .mn-svg { width: 20px; height: 20px; }
    .mn-search-icon { display: inline-flex; background: transparent; }
    .mn-burger { display: inline-flex; }
    .mn-login { height: 38px; padding: 0 .9rem; border-radius: 6px; font-size: var(--text-lg); }
    .mn-login .mn-svg { width: 17px; height: 17px; }
    .mn-user .ms-user-name, .mn-user .ms-user-caret, .mn-user .ms-user-button > .ms-pro-badge { display: none; }
    .mn-user .ms-user-button { height: 38px; padding: 2px; border-radius: 50%; }
    .mn-user .ms-avatar { width: 34px; height: 34px; }
    .mn-user .ms-user-menu { width: min(18rem, calc(100vw - 2rem)); }

    .mn-drawer kbd { display: none; }
}

/* ---- Side menu ---- */
.mn-drawer { position: fixed; top: 0; left: 0; bottom: 0; z-index: 1045; display: flex; flex-direction: column; width: min(370px, 88vw); height: 100vh; height: 100dvh; padding: 1.1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); border-radius: 0 26px 26px 0; background: var(--ms-card); box-shadow: 20px 0 50px rgba(10, 12, 20, .25); overflow-y: auto; overscroll-behavior: contain; transform: translateX(-105%); visibility: hidden; transition: transform .28s ease, visibility .28s; }
[dir="rtl"] .mn-drawer { left: auto; right: 0; border-radius: 26px 0 0 26px; transform: translateX(105%); }
.mn-drawer.is-open { transform: none; visibility: visible; }
.mn-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.mn-drawer-head img { height: 34px; width: auto; }
.mn-drawer-head .mn-logo { flex: 0 0 auto; justify-content: flex-start; }
.mn-drawer-head .mn-icon-btn { background: transparent; }
.mn-drawer-search { display: flex; align-items: center; gap: .6rem; width: 100%; height: 48px; flex-shrink: 0; padding: 0 .6rem 0 .95rem; border: 1px solid var(--ms-line); border-radius: 6px; background: rgba(13, 34, 55, .07); color: var(--ms-muted); font-size: var(--text-xl); cursor: pointer; }
.mn-drawer-search span { flex: 1; text-align: left; }
.mn-drawer-search .mn-svg { width: 20px; height: 20px; }
.mn-drawer-user { display: flex; align-items: center; gap: .7rem; margin-top: .9rem; padding: .7rem .8rem; border-radius: 6px; background: var(--ms-bg-pink); text-decoration: none !important; }
.mn-drawer-user > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mn-drawer-user b { color: var(--ms-ink); font-size: var(--text-xl); }
.mn-drawer-user small { color: var(--ms-muted); font-size: var(--text-md); }
.mn-drawer-nav { display: flex; flex-direction: column; gap: .15rem; margin: .9rem 0; padding-bottom: .9rem; border-bottom: 1px solid var(--ms-line); }
.mn-drawer-link { position: relative; display: flex; align-items: center; gap: .9rem; padding: .68rem .75rem; border-radius: 6px; color: var(--ms-ink) !important; font-size: var(--text-xl); font-weight: 500; text-decoration: none !important; transition: background-color .15s; }
.mn-drawer-link:hover { background: rgba(13, 34, 55, .08); }
.mn-drawer-link.active { background: var(--ms-red-soft); color: var(--ms-red) !important; font-weight: 600; }
.mn-drawer-link.active .mn-drawer-icon { color: var(--ms-red); }
.mn-drawer-icon { display: flex; }
.mn-drawer-text { flex: 1; min-width: 0; }
.mn-drawer-link .mn-new { position: static; margin-right: auto; margin-left: -.3rem; box-shadow: none; }
.mn-drawer-link small { color: var(--ms-muted); font-size: var(--text-md); font-weight: 600; }
.mn-drawer-link > .mn-svg:last-child { width: 16px; height: 16px; color: var(--ms-muted); }
.mn-drawer-foot { display: flex; flex-direction: column; gap: .75rem; margin-top: auto; }
.mn-drawer-login { display: flex; align-items: center; justify-content: center; gap: .55rem; height: 52px; border-radius: 6px; background: linear-gradient(135deg, var(--ms-red), var(--ms-red)); color: #fff !important; font-size: var(--text-2xl); font-weight: 600; text-decoration: none !important; box-shadow: 0 10px 24px rgba(240, 102, 105, .3); }
.mn-drawer-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.mn-drawer-btn { display: flex; align-items: center; justify-content: center; gap: .45rem; height: 46px; border: 1px solid var(--ms-line); border-radius: 6px; color: var(--ms-ink) !important; font-weight: 600; text-decoration: none !important; }
.mn-drawer-btn .mn-svg { width: 18px; height: 18px; color: var(--ms-red); }
.mn-drawer-btn:hover { border-color: var(--ms-red); }
.mn-premium { display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; border-radius: 6px; background: linear-gradient(135deg, #fadcd9, #fadcd9); text-decoration: none !important; }
html.dark .mn-premium { background: linear-gradient(135deg, rgba(240, 102, 105, .16), rgba(240, 102, 105, .08)); }
.mn-premium-icon { display: flex; color: #f59e0b; }
.mn-premium-icon .mn-svg { width: 30px; height: 30px; }
.mn-premium > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; }
.mn-premium b { color: var(--ms-ink); font-size: var(--text-xl); }
.mn-premium small { color: var(--ms-text); font-size: var(--text-base); }
.mn-premium > .mn-svg:last-child { width: 16px; height: 16px; color: var(--ms-ink); }
.mn-theme { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .4rem .3rem; border: 0; background: transparent; color: var(--ms-ink); font-size: var(--text-xl); cursor: pointer; }
.mn-theme span { flex: 1; text-align: left; }
.mn-switch { position: relative; width: 50px; height: 28px; border-radius: 99px; background: rgba(13, 34, 55, .25); transition: background-color .2s; }
.mn-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .2s; }
.mn-theme[aria-pressed="true"] .mn-switch { background: var(--ms-red); }
.mn-theme[aria-pressed="true"] .mn-switch::after { transform: translateX(22px); }

/* ---- Tool search popup ---- */
.mn-palette { position: fixed; inset: 0; z-index: 1060; display: flex; justify-content: center; align-items: flex-start; padding: 9vh 1rem 1rem; }
.mn-palette[hidden] { display: none; }
.mn-palette-backdrop { position: absolute; inset: 0; background: rgba(12, 14, 22, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: mn-fade .15s; }
.mn-palette-box { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 620px; max-height: 78vh; border: 1px solid var(--ms-line); border-radius: 6px; background: var(--ms-card); box-shadow: 0 30px 80px rgba(10, 12, 20, .35); overflow: hidden; animation: mn-pop .18s ease; }
.mn-palette-field { display: flex; align-items: center; gap: .7rem; padding: 0 1rem 0 1.15rem; border-bottom: 1px solid var(--ms-line); }
.mn-palette-field .mn-svg { color: var(--ms-red); }
.mn-palette-field input { flex: 1; min-width: 0; height: 60px; border: 0; outline: 0; background: transparent; color: var(--ms-ink); font-size: var(--text-2xl); }
.mn-palette-field input::-webkit-search-cancel-button { display: none; }
.mn-palette-esc { padding: .2rem .5rem; border: 1px solid var(--ms-line); border-radius: 6px; background: transparent; color: var(--ms-muted); font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.mn-palette-group[hidden] { display: none; }
.mn-palette-label { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: .5rem; padding: .85rem .65rem .4rem; background: var(--ms-card); color: var(--ms-ink); font-size: var(--text-md); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.mn-palette-label .mn-svg { width: 17px; height: 17px; }
.mn-palette-label > span:first-child { display: flex; }
.mn-palette-label i { padding: .05rem .45rem; border-radius: 99px; background: rgba(13, 34, 55, .12); color: var(--ms-muted); font-size: var(--text-sm); font-style: normal; letter-spacing: 0; }
.mn-palette-group + .mn-palette-group { margin-top: .2rem; border-top: 1px solid var(--ms-line); }
.mn-palette-list { padding: 0 .55rem .55rem; overflow-y: auto; overscroll-behavior: contain; }
.mn-palette-item { display: flex; align-items: center; gap: .8rem; padding: .6rem .7rem; border-radius: 6px; color: var(--ms-ink) !important; text-decoration: none !important; }
.mn-palette-item[hidden] { display: none; }
.mn-palette-item.is-selected { background: var(--ms-red-soft); }
.mn-palette-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 6px; background: var(--ms-red-soft); color: var(--ms-red); }
.mn-palette-icon svg { width: 15px; height: 15px; fill: currentColor; }
.mn-palette-item.is-selected .mn-palette-icon { background: var(--ms-red); color: #fff; }
.mn-palette-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mn-palette-item small { color: var(--ms-muted); font-size: var(--text-md); white-space: nowrap; }
.mn-palette-empty { padding: 1.6rem 1.2rem; color: var(--ms-muted); text-align: center; }
.mn-palette-empty[hidden] { display: none; }
.mn-palette-foot { display: flex; align-items: center; gap: 1.1rem; padding: .65rem 1.1rem; border-top: 1px solid var(--ms-line); color: var(--ms-muted); font-size: var(--text-md); }
.mn-palette-foot kbd { margin-right: .15rem; }
.mn-palette-foot a { margin-left: auto; color: var(--ms-red); font-weight: 600; }
@keyframes mn-fade { from { opacity: 0; } }
@keyframes mn-pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

@media (max-width: 575.98px) {
    .mn-palette { padding: 0; }
    .mn-palette-box { max-width: none; max-height: 85vh; border-radius: 0 0 6px 6px; border-top: 0; }
    .mn-palette-foot span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .mn-drawer, .mn-palette-box, .mn-palette-backdrop { transition: none; animation: none; }
}
