/* Shared shell: header controls, command palette, mobile navigation. Colours come from the theme tokens. */

/* ---- Telegram reminder (public/telegramNudge.js) ---- */
.shell-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); background: var(--surface-1); border: 1px solid var(--accent-border); border-radius: var(--r-2); font-size: var(--fs-2); color: var(--text-2); }
.shell-nudge-text { flex: 1 1 260px; min-width: 0; }

/* ---- app shell: a fixed left sidebar on every sub-page (built by shell.js). The chart page keeps its own header. ---- */
:root { --side-w: 236px; }
.bot-page { margin: 0 0 0 var(--side-w); max-width: none; padding: 0 var(--s-6) 110px; }
.bot-page > .bp-shell, .bot-page > main { max-width: 1240px; margin-left: auto; margin-right: auto; }
.bot-page .bp-savebar { left: var(--side-w); }

#settingsTopbar[data-shell] {
  position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--side-w); display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-4) var(--s-3); background: var(--surface-0); border-right: 1px solid var(--border); overflow-y: auto; box-sizing: border-box;
}
.shell-brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-1) var(--s-2) var(--s-3); color: var(--text); text-decoration: none; font-size: var(--fs-4); font-weight: var(--fw-semibold); letter-spacing: -.01em; }
.shell-name { font-weight: var(--fw-semibold); letter-spacing: -.01em; }
.shell-nav { display: flex; flex-direction: column; gap: 2px; }
.shell-label { padding: var(--s-4) var(--s-2) var(--s-1); font-size: var(--fs-1); font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); }
.shell-link { display: flex; align-items: center; gap: var(--s-3); height: 34px; padding: 0 var(--s-2); border-radius: var(--r-1); color: var(--text-2); text-decoration: none; font-size: var(--fs-3); font-weight: var(--fw-medium); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.shell-link svg { flex: none; width: 16px; height: 16px; color: var(--text-3); transition: color var(--dur) var(--ease); }
.shell-link:hover { background: var(--surface-2); color: var(--text); }
.shell-link:hover svg { color: var(--text-2); }
.shell-link.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.shell-link.active svg { color: var(--accent-text); }
.shell-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s-2); padding-top: var(--s-4); }
.shell-userrow { display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-1) 0 var(--s-2); }
.shell-userrow .bp-who { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: var(--fs-2); }
.shell-foot .bp-ghost { width: 100%; justify-content: center; }
.shell-userrow .shell-signout-icon { display: none; }

.shell-search { display: flex; align-items: center; gap: var(--s-2); height: 34px; padding: 0 var(--s-2); border-radius: var(--r-1); background: var(--surface-1); border: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-2); font-weight: var(--fw-medium); cursor: pointer; transition: border-color var(--dur), color var(--dur); }
.shell-search svg { flex: none; }
.shell-search span { flex: 1; text-align: left; }
.shell-search:hover { color: var(--text); border-color: var(--border-strong); }
.shell-search kbd { font: 600 var(--fs-1)/1 inherit; font-family: inherit; padding: 3px 6px; border-radius: var(--r-1); background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-2); }
.shell-icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; padding: 0; border-radius: var(--r-1); background: transparent; border: 1px solid transparent; color: var(--text-3); cursor: pointer; transition: background var(--dur), color var(--dur); }
.shell-icon-btn:hover { color: var(--text); background: var(--surface-2); }
html[data-theme="light"] .ic-moon { display: none; }
html:not([data-theme="light"]) .ic-sun { display: none; }

/* phone top bar + drawer backdrop (hidden on larger screens) */
.shell-mobilebar, .shell-backdrop { display: none; }
.shell-burger { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: var(--r-1); background: transparent; border: 1px solid var(--border); color: var(--text-2); cursor: pointer; }

/* tablet: the sidebar collapses to an icon rail */
@media (max-width: 1100px) and (min-width: 861px) {
  :root { --side-w: 64px; }
  .shell-brand, .shell-label, .shell-link span, .shell-search span, .shell-search kbd, .shell-userrow .bp-who, .shell-foot .bp-ghost { display: none; }
  .shell-link { justify-content: center; padding: 0; }
  .shell-search { justify-content: center; padding: 0; }
  .shell-userrow { flex-direction: column; justify-content: center; padding: 0; }
  .shell-userrow .shell-signout-icon { display: inline-flex; }
  .shell-nav { align-items: stretch; }
}

/* phone: the sidebar is an off-canvas drawer opened from a slim top bar */
@media (max-width: 860px) {
  :root { --side-w: 0px; }
  .bot-page { margin-left: 0; padding: 56px var(--s-3) 110px; }
  .bot-page .bp-savebar { left: 0; }
  #settingsTopbar[data-shell] { width: 264px; transform: translateX(-100%); transition: transform .22s var(--ease); z-index: 60; box-shadow: none; }
  #settingsTopbar[data-shell].nav-open { transform: translateX(0); box-shadow: var(--shadow-float); }
  .shell-mobilebar { display: flex; align-items: center; gap: var(--s-3); position: fixed; z-index: 40; top: 0; left: 0; right: 0; height: 48px; padding: 0 var(--s-3); background: var(--surface-0); border-bottom: 1px solid var(--border); }
  .shell-mobilebar .shell-brand { padding: 0; flex: 1; }
  .shell-backdrop { position: fixed; inset: 0; z-index: 50; background: var(--scrim); }
  #settingsTopbar.nav-open + .shell-backdrop { display: block; }
}

/* ---- command palette ---- */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 14vh 16px 16px;
  background: var(--scrim);
}
.cmdk-overlay[hidden] { display: none; }
.cmdk-box {
  width: 100%; max-width: 560px; background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--r-3);
  box-shadow: var(--shadow-float); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh;
}
.cmdk-input {
  width: 100%; border: none; border-bottom: 1px solid var(--border-strong); background: transparent; color: var(--text);
  padding: 16px 18px; font-size: var(--fs-5); outline: none;
}
.cmdk-input::placeholder { color: var(--text-2); }
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-group { padding: 10px 12px 4px; font-size: var(--fs-1); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.cmdk-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--r-2); cursor: pointer; color: var(--text); font-size: var(--fs-3); }
.cmdk-item.active { background: var(--surface-3); }
.cmdk-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-hint { color: var(--text-2); font-size: var(--fs-1); white-space: nowrap; }
.cmdk-empty { padding: 26px 12px; text-align: center; color: var(--text-2); font-size: var(--fs-3); }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--border-strong); color: var(--text-2); font-size: var(--fs-1); }
.cmdk-foot kbd { font: 600 var(--fs-1)/1 inherit; font-family: inherit; padding: 2px 5px; margin-right: 3px; border-radius: var(--r-1); background: var(--surface-3); border: 1px solid var(--border-strong); }

@media (max-width: 480px) {
  .cmdk-overlay { padding-top: 8vh; }
}
.shell-link.is-disabled { opacity: .4; cursor: not-allowed; }
.shell-link.is-disabled:hover { background: transparent; color: var(--text-2); }
