/* Language / currency menus (every layout) and the signed-in app shell — ported from ogboost
   frontend/static/css/sidebar.css: fixed rail on the inline-start edge on desktop, off-canvas
   drawer below 900px (toggle, scrim, Esc and scroll lock live in app.js). */

/* —— Menus: <details> dropdowns, usable without JS —— */
.dd { position: relative; }
.dd > summary { list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-btn { gap: 6px; white-space: nowrap; }
.dd-btn .dd-chev { opacity: .55; transition: transform .2s var(--ease); }
.dd[open] > .dd-btn .dd-chev { transform: rotate(180deg); }
.dd-menu { position: absolute; z-index: 90; top: calc(100% + 8px); inset-inline-end: 0; display: grid; gap: 2px; min-width: 220px; max-height: min(24rem, 70vh); overflow-y: auto; margin: 0; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 30px 60px -20px rgb(var(--shade-rgb)); animation: pop .18s var(--ease); }
.dd-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text-2); font: inherit; font-size: .9rem; font-weight: 600; text-align: start; cursor: pointer; }
.dd-item small { flex: none; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.dd-item:hover, .dd-item:focus-visible { background: var(--panel-3); color: var(--text); outline: none; }
.dd-item.is-active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.dd-item.is-active small { color: var(--accent); }
.fx-note { display: flex; align-items: flex-start; gap: 6px; margin: 10px 0 0; }
.fx-note .ic { flex: none; margin-top: 3px; }

/* —— App shell —— */
.app-shell { --sb-w: 15.875rem; --sb-bg: #0c0c0d; --sb-line: #1f1f22; --sb-hover: #161618; --sb-active: #1d1d20; --sb-soft: #a1a1aa; --sb-faint: #63636b; }
.app-shell .sb { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 70; display: flex; flex-direction: column; width: var(--sb-w); height: 100vh; height: 100dvh;
  background: var(--sb-bg); border-inline-end: 1px solid var(--sb-line); }
.app-shell .shell-stage { max-width: none; margin: 0; margin-inline-start: var(--sb-w); padding: 28px clamp(16px, 3vw, 40px) 0; }
.app-shell .shell-stage > * { max-width: 1180px; margin-inline: auto; }

.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 4.5rem; padding: 0 1.1rem; border-bottom: 1px solid var(--sb-line); }
.sb-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; }
.sb-brand img { flex: none; border-radius: 9px; }
.sb-brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-nav { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; padding: .85rem .7rem 1rem; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #2a2a2e transparent; }
.sb-label { margin: 1.05rem .75rem .35rem; color: var(--sb-faint); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
html[dir="rtl"] .sb-label { letter-spacing: 0; font-size: .76rem; }
.sb-link { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 2.5rem; padding: .5rem .75rem; border: 1px solid transparent; border-radius: 10px;
  color: var(--sb-soft); font-size: .9rem; font-weight: 600; cursor: pointer; transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
.sb-link > .ic:first-child { flex: none; }
.sb-link > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-link:hover { background: var(--sb-hover); color: var(--text); }
.sb-link.is-active { background: var(--sb-active); border-color: #2a2a2e; color: var(--text); }
.sb-link.is-active > .ic:first-child { color: var(--accent); }
.sb-link.is-current { color: var(--text); }
.sb-group > summary { list-style: none; }
.sb-group > summary::-webkit-details-marker { display: none; }
.sb-chevron { flex: none; color: var(--sb-faint); transition: transform .2s var(--ease); }
.sb-group[open] > summary .sb-chevron { transform: rotate(180deg); }
.sb-sub { display: flex; flex-direction: column; gap: 1px; margin: .15rem 0 .4rem; margin-inline-start: 1.32rem; padding-inline-start: .8rem; border-inline-start: 1px solid var(--sb-line); }
.sb-sublink { display: flex; align-items: center; gap: .6rem; min-height: 2.15rem; padding: .3rem .5rem; border-radius: 8px; color: var(--sb-soft); font-size: .86rem; font-weight: 500;
  transition: background-color .18s ease, color .18s ease; }
.sb-sublink > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-sublink .cat-logo { width: 24px; height: 24px; flex: none; border-radius: 7px; }
.sb-sublink .cat-logo img { width: 15px; height: 15px; }
.sb-sublink .cat-logo .logo-mono { font-size: .55rem; }
.sb-sublink:hover { background: var(--sb-hover); color: var(--text); }
.sb-sublink.is-active { background: var(--sb-active); color: var(--text); }
.sb-more { color: var(--sb-faint); }

/* Sign-out pinned to the bottom of the rail */
.sb-foot { flex: none; margin: 0; padding: .7rem .7rem max(.7rem, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--sb-line); }
.sb-logout { background: transparent; font: inherit; font-size: .9rem; text-align: start; }
.sb-logout:hover { background: var(--danger-soft); color: var(--danger); }

.sb-icon-btn { display: inline-grid; place-items: center; width: 2.3rem; height: 2.3rem; flex: none; padding: 0; border: 1px solid var(--sb-line); border-radius: 10px; background: transparent;
  color: var(--sb-soft); cursor: pointer; transition: background-color .18s ease, color .18s ease; }
.sb-icon-btn:hover { background: var(--sb-hover); color: var(--text); }
.sb-link:focus-visible, .sb-sublink:focus-visible, .sb-icon-btn:focus-visible { outline: 2px solid rgb(var(--ink-rgb) / .55); outline-offset: 2px; }
.sb-mobilebar, .sb-head .sb-close, .sb-scrim { display: none; }

/* —— Off-canvas drawer —— */
@media (max-width: 900px) {
  .sb-mobilebar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: .65rem; min-height: 3.5rem; padding: max(.45rem, env(safe-area-inset-top, 0px)) 1rem .45rem;
    background: rgb(var(--bg-rgb) / .92); border-bottom: 1px solid var(--sb-line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .sb-mobilebar .sb-brand { flex: 1 1 auto; }
  .sb-mobile-bal { flex: none; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .35rem .7rem; border: 1px solid var(--sb-line); border-radius: 999px;
    color: var(--text); font-size: .82rem; font-weight: 700; }
  .sb-head .sb-close { display: inline-grid; }
  .app-shell .sb { z-index: 101; width: min(18rem, 86vw); box-shadow: 24px 0 60px rgb(var(--shade-rgb) / .55); transform: translateX(-105%); visibility: hidden;
    transition: transform .28s var(--ease), visibility 0s linear .28s; }
  html[dir="rtl"] .app-shell .sb { transform: translateX(105%); box-shadow: -24px 0 60px rgb(var(--shade-rgb) / .55); }
  html .app-shell .shell.is-nav-open .sb { transform: none; visibility: visible; transition: transform .28s var(--ease), visibility 0s; }
  .shell.is-nav-open .sb-scrim { display: block; position: fixed; inset: 0; z-index: 100; background: rgb(var(--shade-rgb) / .55); }
  .app-shell .shell-stage { margin-inline-start: 0; padding: 20px 16px 0; }
}
body.nav-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .app-shell .sb, .sb-chevron, .sb-link, .sb-sublink, .dd-btn .dd-chev, .dd-menu { transition: none !important; animation: none !important; }
}
body.nav-locked #chat-root { visibility: hidden; }

/* —— Announcement bar and availability chips —— */
.announce { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-weight: 600; font-size: .92rem; }
.announce > span { flex: 1 1 auto; min-width: 0; }
.announce-info .ic:first-child { color: var(--accent); }
.announce-promo { border-color: rgb(var(--accent-rgb) / .3); background: linear-gradient(90deg, rgb(var(--accent-rgb) / .1), rgb(var(--accent-rgb) / .02)); }
.announce-promo .ic:first-child { color: var(--accent); }
.announce-warning { border-color: rgba(245, 197, 66, .3); background: var(--warn-soft); color: var(--warn); }
a.announce:hover { border-color: var(--accent); }
.announce-go { flex: none; opacity: .7; }
.chip-danger { background: rgba(251, 113, 133, .12); color: #fb7185; border-color: rgba(251, 113, 133, .3); }
