/* =====================================================================================
   Athena shell: one sidebar (workspace, search, grouped navigation, the open module's sections nested
   under it, tools and account). Loaded after premium.css. Collapses to an icon rail; a drawer on phones.
   ===================================================================================== */
#app { display: flex; height: 100vh; height: 100dvh; }

.sidebar { position: relative; width: 256px; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 10px;
  background: var(--nav); border-right: 1px solid var(--line-2); overflow: hidden; transition: width .22s var(--ease), padding .22s var(--ease); z-index: 20; }

/* brand + collapse */
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 32px; padding: 0 2px 0 8px; }
.sb-brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--text); text-decoration: none; font-size: 15px; letter-spacing: -.02em; white-space: nowrap; }
.sb-brand:hover { text-decoration: none; }
.sb-brand img { flex: none; }
.sb-brand span { color: var(--text-3); font-weight: 500; } .sb-brand b { color: var(--text); font-weight: 650; }
.sb-collapse { color: var(--text-3); flex: none; }

/* workspace (which group the whole app is showing) */
.sb-ws { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.sb-ws:hover { border-color: var(--line); box-shadow: var(--shadow-md); }
.sb-ws-mark { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; background: var(--primary); color: var(--on-primary); font-weight: 650; font-size: 12px; }
.sb-ws-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sb-ws-txt b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-ws-txt small { font-size: 11.5px; color: var(--text-3); }
.sb-ws-caret { color: var(--text-3); flex: none; }

/* search + new post */
.sb-quick { display: flex; gap: 6px; }
.sb-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 10px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface-2); color: var(--text-3); cursor: pointer; font: inherit; font-size: 13px; transition: background .15s, border-color .15s, color .15s; }
.sb-search:hover { background: var(--surface); border-color: var(--line); color: var(--text-2); }
.sb-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; }
.sb-search kbd { font: 500 10.5px var(--font); padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text-3); white-space: nowrap; }
.sb-new { width: 32px; height: 32px; flex: none; border: 0; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgba(21, 23, 28, .2), inset 0 1px 0 rgba(255, 255, 255, .08); transition: background .15s, transform .08s; }
.sb-new:hover { background: var(--primary-h); } .sb-new:active { transform: translateY(1px); }

/* navigation */
.sb-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -6px; padding: 2px 6px 8px; scrollbar-width: none; }
.sb-nav::-webkit-scrollbar { display: none; }
.sb-group + .sb-group { margin-top: 14px; }
.sb-gt { font-size: 11.5px; font-weight: 500; color: var(--text-3); padding: 0 10px 4px; }
.sb-item { position: relative; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--nav-text);
  text-decoration: none; font-size: 13.5px; font-weight: 500; transition: background .12s, color .12s; }
.sb-item:hover { background: var(--nav-hover); color: var(--text); text-decoration: none; }
.sb-item.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.sb-item.active::before { content: ''; position: absolute; left: -6px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sb-ic { width: 18px; display: grid; place-items: center; flex: none; color: var(--text-3); transition: color .12s; }
.sb-item:hover .sb-ic, .sb-item.active .sb-ic { color: var(--text); }
.sb-lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.sb-item.active .sb-count { background: var(--accent-soft); color: var(--accent-ink); }

/* the open module's own sections, nested under it on a guide line */
.sidebar .subnav.sb-sub { position: static; transform: none; width: auto; display: block; background: none; border: 0; box-shadow: none; overflow: visible;
  margin: 4px 0 8px 18px; padding: 0 0 0 10px; border-left: 1px solid var(--line); color: var(--nav-text); }
.sidebar .subnav.sb-sub[hidden], .sidebar .subnav.sb-sub.folded { display: none; }
.sidebar .subnav.sb-sub.sb-sub-in { animation: sb-sub-in .22s var(--ease, ease-out); }
@keyframes sb-sub-in { from { transform: translateY(-4px); } }
.sb-caret { margin-left: auto; display: inline-grid; color: var(--text-3); transition: transform .18s var(--ease, ease-out); }
.sb-count + .sb-caret { margin-left: 6px; }
.sb-item[aria-expanded="false"] .sb-caret { transform: rotate(-90deg); }
.sidebar.collapsed .sb-caret { display: none; }
@media (prefers-reduced-motion: reduce) { .sidebar .subnav.sb-sub.sb-sub-in { animation: none; } .sb-caret { transition: none; } }
.sidebar .sb-sub a, .sidebar .sb-sub .nav-i { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; margin: 0; padding: 5px 8px; border-radius: 7px;
  font-size: 13px; font-weight: 450; color: var(--text-2); box-shadow: none; background: none; }
.sidebar .sb-sub a:hover, .sidebar .sb-sub .nav-i:hover { background: var(--nav-hover); color: var(--text); text-decoration: none; }
.sidebar .sb-sub a.active { background: transparent; color: var(--text); font-weight: 600; box-shadow: none; }
.sidebar .sb-sub a.active::after { content: ''; position: absolute; left: -14px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--nav); }
.sidebar .sb-sub a.nav-child, .sidebar .sb-sub .nav-child { padding-left: 8px; }
.sidebar .sb-sub a > svg.ic:first-child, .sidebar .sb-sub .nav-i > svg.ic:first-child { display: none; }
.sidebar .sb-sub .nav-section { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 3px; font-size: 11.5px; font-weight: 500; color: var(--text-3); text-transform: none; }
.sidebar .sb-sub > .nav-section:first-child { padding-top: 2px; }
.sidebar .sb-sub .nav-count { margin-left: auto; background: var(--surface-3); color: var(--text-2); font-size: 11px; padding: 0 6px; border-radius: 9px; }
.sidebar .sb-sub a.active .nav-count { background: var(--accent-soft); color: var(--accent-ink); }
.sidebar .sb-sub .new-post, .sidebar .sb-sub .btn { width: 100%; justify-content: center; margin: 2px 0 8px; }
.sidebar .sb-sub .new-post > svg.ic:first-child { display: inline-block; }
/* Instagram leaders and other rich rows keep their faces */
.sidebar .sb-sub a.ig-lead { padding: 5px 8px; gap: 9px; }
.sidebar .sb-sub .ig-lead-face { width: 28px; height: 28px; }
.sidebar .sb-sub .ig-lead-face img, .sidebar .sb-sub .ig-lead-face b { border-color: var(--nav); }

/* tools + account */
.sb-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.sb-tools { display: flex; gap: 2px; }
.sb-tool { position: relative; flex: 1; height: 30px; border: 0; background: none; border-radius: 7px; display: grid; place-items: center; color: var(--text-3); cursor: pointer; text-decoration: none; transition: background .12s, color .12s; }
.sb-tool:hover, .sb-tool.active { background: var(--nav-hover); color: var(--text); text-decoration: none; }
.sb-dot { position: absolute; top: 6px; left: calc(50% + 4px); width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--nav); }
.sb-me { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; color: var(--text); font: inherit; transition: background .12s; }
.sb-me:hover { background: var(--nav-hover); }
.sb-me > .av, .sb-me > span:first-child { flex: none; }
.sb-me-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sb-me-txt b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-me-txt small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-me-more { color: var(--text-3); flex: none; }

/* collapsed: an icon rail (hover any icon for its name) */
.sidebar.collapsed { width: 60px; padding: 12px 8px 10px; }
.sidebar.collapsed .sb-brand span, .sidebar.collapsed .sb-ws-txt, .sidebar.collapsed .sb-ws-caret, .sidebar.collapsed .sb-search span,
.sidebar.collapsed .sb-search kbd, .sidebar.collapsed .sb-lbl, .sidebar.collapsed .sb-gt, .sidebar.collapsed .subnav.sb-sub,
.sidebar.collapsed .sb-me-txt, .sidebar.collapsed .sb-me-more { display: none !important; }
.sidebar.collapsed .sb-head { flex-direction: column; height: auto; gap: 8px; padding: 0; }
.sidebar.collapsed .sb-brand { gap: 0; }
.sidebar.collapsed .sb-ws { justify-content: center; padding: 4px; border-color: transparent; background: none; box-shadow: none; }
.sidebar.collapsed .sb-quick { flex-direction: column; }
.sidebar.collapsed .sb-search { justify-content: center; padding: 0; }
.sidebar.collapsed .sb-new { width: 100%; }
.sidebar.collapsed .sb-item { justify-content: center; padding: 0; }
.sidebar.collapsed .sb-count { position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
.sidebar.collapsed .sb-group + .sb-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.sidebar.collapsed .sb-tools { flex-direction: column; }
.sidebar.collapsed .sb-me { justify-content: center; padding: 4px; }

/* the old two-column shell is gone */
.rail, .subnav-foot, .subnav-h { display: none !important; }
.mob-nav { display: none; }

@media (max-width: 900px) {
  .sidebar, .sidebar.collapsed { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; padding: 12px 10px 10px; transform: translateX(-102%); transition: transform .24s var(--ease); box-shadow: var(--shadow-lg); z-index: 40; }
  body.mobile-nav-open .sidebar { transform: none; }
  body.mobile-nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(13, 14, 17, .42); z-index: 30; }
  .sidebar.collapsed .sb-brand span, .sidebar.collapsed .sb-ws-txt, .sidebar.collapsed .sb-lbl, .sidebar.collapsed .sb-gt, .sidebar.collapsed .sb-search span,
  .sidebar.collapsed .sb-me-txt { display: revert !important; }
  .sb-collapse { display: none; }
  .mob-nav { display: grid; position: fixed; left: 12px; top: 12px; z-index: 25; width: 38px; height: 38px; place-items: center; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); cursor: pointer; }
  .page-h { padding-left: 62px; }
}
/* The module's own first heading repeats the item it sits under ("Instagram Intelligence" under Instagram). */
.sidebar .sb-sub > .nav-section:first-child { display: none; }
:root[data-theme="dark"] .sb-brand img { content: url(/brand/athena-mark-dark.svg); }
/* expanding lives in the sidebar itself (and the drawer button on phones) */
.nav-expand { display: none !important; }

/* "new data" pill: offered at the top of the page, never a surprise reload */
.main { position: relative; }
.live-pill { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 30; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 0; border-radius: 999px; background: var(--primary); color: var(--on-primary); font: inherit; font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); cursor: pointer; animation: pill-in .25s var(--ease); }
.live-pill:hover { background: var(--primary-h); }
@keyframes pill-in { from { opacity: 0; transform: translate(-50%, -6px); } }

/* Shown after a server restart, when this page still runs the previous code. */
.update-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 9999; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13.5px; }

/* Dashboard full screen: the main canvas becomes the viewport; all existing page-level scrolling stays intact. */
.dashboard-fullscreen-btn { white-space: nowrap; }
.dashboard-fullscreen-btn.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.main:fullscreen { width: 100vw; height: 100vh; max-width: none; background: var(--bg); color: var(--text); }
.main:fullscreen .page-h { position: sticky; top: 0; z-index: 35; }
body.dashboard-fullscreen-view .sidebar,
body.dashboard-fullscreen-view .mob-nav { display: none !important; }
body.dashboard-fullscreen-fallback #main { position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100vh; height: 100dvh; max-width: none; }
body.dashboard-fullscreen-view .page-inner,
body.dashboard-fullscreen-view .page-narrow { max-width: none; }
@media (max-width: 640px) { .dashboard-fullscreen-btn span { display: none; } }

/* Sidebar groups fold on their title (7 Oct 2026) */
button.sb-gt { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left; border-radius: 8px; padding-top: 4px; padding-bottom: 4px; margin-bottom: 2px; }
button.sb-gt:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
button.sb-gt svg { transition: transform .18s; transform: rotate(90deg); opacity: .6; } .sb-group.folded > button.sb-gt svg { transform: none; }
.sb-group.folded > :not(.sb-gt) { display: none; }
.sidebar.collapsed .sb-group.folded > :not(.sb-gt) { display: revert; }
