/* ── FULL-VIEWPORT APP SHELL ─────────────────────────────────── */
html, body { height: 100%; }
body { overflow: hidden; display: flex; flex-direction: column; }

/* Nothing in the body is selectable as text (stops accidental selection on tap).
   Only form fields stay editable — everything else, including logs/ledgers, is not
   selectable (use the COPY / SAVE buttons instead). */
body {
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, select {
  -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text;
}

.header-inner {
  max-width: 400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── WALLET BAR (fixed top strip) ────────────────────────────── */
#wallet-bar {
  position: fixed;   /* never scrolls */
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 400px;
  z-index: 1000;     /* always on top — above the side drawers (200/300) and dropdown (500) */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  background: #13131f;
  border-bottom: 1px solid #ffffff12;
  cursor: pointer;
  user-select: none;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #8888aa;
  transition: color .15s;
}
#wallet-bar:hover { color: #f0f0f8; }

/* ── WALLET DROPDOWN (slides down from below the bar) ────────── */
#wallet-dropdown {
  position: fixed;
  left: 50%;
  top: 36px;
  width: calc(100% - 28px);
  max-width: 400px;
  max-height: calc(100vh - 36px);
  z-index: 500;
  background: #13131f;
  border: 1px solid #ffffff12;          /* match drawer panels */
  border-top: none;                     /* joins the wallet bar above it */
  border-radius: 0;                     /* square corners, like the drawer panels */
  box-shadow: 0 8px 16px #00000044;     /* match the drawer panels' shadow */
  transform: translateX(-50%) translateY(-120%);
  transition: transform .35s ease;
  display: flex;
  flex-direction: column;
}
#wallet-dropdown.open { transform: translateX(-50%) translateY(0); }

#wallet-dropdown-inner {
  padding: 20px 16px 20px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #a78bfa33 transparent;
}
#wallet-dropdown-inner::-webkit-scrollbar       { width: 4px; }
#wallet-dropdown-inner::-webkit-scrollbar-track { background: transparent; }
#wallet-dropdown-inner::-webkit-scrollbar-thumb { background: #a78bfa33; border-radius: 4px; }
#wallet-dropdown-inner::-webkit-scrollbar-thumb:hover { background: #a78bfa; }

/* ── HEADER OFFSET (room for fixed wallet bar) ───────────────── */
.header { padding-top: 36px; }

/* ── APP LAYOUT ──────────────────────────────────────────────── */
#app-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

#center-col {
  max-width: 400px;
  margin: 0 auto;
  padding: 16px 14px;
  /* Modest bottom clearance so the last element isn't flush against the mobile chrome. */
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;             /* clean look — still scrolls by touch/wheel, no visible bar */
  -ms-overflow-style: none;
}
#center-col::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Removed the full-width "START ALL SNIPERS" bar — redundant now (Risky is armed by
   default and each panel has its own START/STOP), and it crowded the bottom handle. */
#arm-all-btn { display: none; }

/* Mode switch (PAPER | LIVE) is now an in-flow element at the bottom of the center
   column — styled inline in _modeSwitchHtml; no fixed bar. */
/* On narrow screens the center column goes full-width and its edges slip UNDER the
   36px side-panel handles. Inset it past the handles so the main view fits between
   them (38px = 36px handle + 2px gap). */
@media (max-width: 480px) {
  #center-col   { margin-left: 38px; margin-right: 38px; }
  /* Header row (date + SOL price) also slips under the side handles — inset it too. */
  .header-inner { padding-left: 38px; padding-right: 38px; }
  /* Give the SOL-price pill's rounded edge a little extra room off the handle. */
  .sol-price    { margin-right: 6px; }
}
#center-tabs {
  padding: 8px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* ── PANEL BACKDROP ──────────────────────────────────────────────
   An open edge-drawer (up to 386px) overlaps the centered 400px column on any window narrower
   than ~1172px (split-screen / half-width) — which used to render as a "ghost panel" floating
   over the Risky side. This dim layer sits BELOW the drawers (200/300) and ABOVE the center
   column, so an open drawer always reads as an intentional overlay. Tap it to close. Only shown
   in the overlap zone (JS gates by width); wide desktops where nothing overlaps are untouched. */
#panel-backdrop {
  position: fixed;
  top: 36px; left: 0;
  width: 100%; height: calc(100vh - 36px);
  background: rgba(8, 8, 16, 0.55);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
#panel-backdrop.show { opacity: 1; pointer-events: auto; }

/* ── SIDE PANELS ─────────────────────────────────────────────── */
#ioo-panel, #watch-panel {
  position: fixed;
  top: 36px;
  height: calc(100vh - 36px);
  overflow: hidden;
  transition: width .3s ease;
  display: flex;
  background: #13131f;
  box-shadow: 2px 0 16px #00000044;
}
#ioo-panel   { left: 0;  flex-direction: row;         width: 36px; border-right: 1px solid #ffffff12; z-index: 200; }
#watch-panel { right: 0; flex-direction: row-reverse; width: 36px; border-left:  1px solid #ffffff12; z-index: 300; }
#ioo-panel.open   { width: 336px; }
#watch-panel.open { width: 336px; }
@media (min-width: 480px) {
  #ioo-panel.open, #watch-panel.open { width: 386px; }
  .panel-content-area { width: 350px; min-width: 350px; }
}

/* ── PANEL HANDLE ────────────────────────────────────────────── */
.panel-handle-col {
  width: 36px;
  min-width: 36px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: #13131f;
}
.panel-handle-col:hover { background: #1a1a2e; }

.ph-tap {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #444466;
  transition: color .15s;
}
.ph-tap:hover { color: #8888aa; }

.ph-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ph-open, .ph-close {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.ph-open span, .ph-close span {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}
.ph-open span  { color: #c8ccf0; }   /* brightened from #444466 — was near-invisible on dark/low-brightness screens */
.ph-close      { display: none; }
.ph-close span { color: #c4b5fd; }   /* brightened from #a78bfa */
#watch-panel .ph-close span { color: #7dd3fc; }   /* brightened from #38bdf8 */

#ioo-panel.open   .ph-open,
#watch-panel.open .ph-open  { display: none; }
#ioo-panel.open   .ph-close,
#watch-panel.open .ph-close { display: flex; }

/* ── PANEL CONTENT ───────────────────────────────────────────── */
.panel-content-area {
  width: 300px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.panel-label {
  flex-shrink: 0;
  padding: 20px 16px 14px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  border-bottom: 1px solid #ffffff12;
}
.ioo-label   { color: #a78bfa; }
.watch-label { color: #38bdf8; }

.panel-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: #a78bfa33 transparent;
}
.panel-scroll-area::-webkit-scrollbar       { width: 4px; }
.panel-scroll-area::-webkit-scrollbar-track { background: transparent; }
.panel-scroll-area::-webkit-scrollbar-thumb { background: #a78bfa33; border-radius: 4px; }
.panel-scroll-area::-webkit-scrollbar-thumb:hover { background: #a78bfa; }

