/* The application frame: sidebar + stage. The sidebar folds to an icon rail; below 860px it becomes a drawer. */
body { overflow: hidden; }
#shell { display: flex; height: 100vh; height: 100dvh; }
#side { flex: none; width: 236px; display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-right: 1px solid var(--line); transition: width .16s ease; z-index: 40; }
#stage { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
#scrim { display: none; }
#side-head { flex: none; height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--line); }
#side-search { flex: none; padding: 10px 12px 6px; }
.side-search { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--text); }
.side-search:focus { outline: none; border-color: var(--accent); }
#side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 8px 16px; scrollbar-width: thin; }
.side-group { margin-top: 10px; }
.side-gh { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; background: none; border: 0; color: var(--faint); font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; cursor: pointer; }
.side-gh:hover { color: var(--muted); } .side-gh .ic { width: 12px; height: 12px; transition: transform .15s; } .side-group.closed .side-gh .ic { transform: rotate(-90deg); }
.side-list { display: flex; flex-direction: column; gap: 1px; }
.side-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-size: 13.5px; font-weight: 550; text-align: left; cursor: pointer; white-space: nowrap; position: relative; }
.side-item .ic { width: 17px; height: 17px; flex: none; } .side-t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-item:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.side-item.on { background: var(--accent-bg); color: var(--accent-2); } .side-item.on::before { content: ''; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-item.locked { opacity: .62; } .side-item.soon { opacity: .7; }
.side-tag { flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px; background: var(--panel-3); color: var(--muted); } .side-tag.warn { background: rgba(245, 185, 66, .16); color: var(--warn); }
.side-lock { flex: none; display: inline-grid; color: var(--faint); } .side-lock .ic { width: 13px; height: 13px; }

body.side-folded #side { width: 60px; }
body.side-folded .brand-t, body.side-folded #side-search, body.side-folded .side-t, body.side-folded .side-tag, body.side-folded .side-gh span { display: none; }
body.side-folded #side-head { padding: 0; justify-content: center; flex-direction: column; gap: 0; height: auto; min-height: var(--nav-h); }
body.side-folded .brand { display: none; } body.side-folded .side-item { justify-content: center; padding: 9px 0; } body.side-folded .side-gh { justify-content: center; padding: 2px 0; } body.side-folded .side-gh .ic { display: none; }
body.side-folded .side-item.on::before { left: -8px; }

.topnav { gap: 10px; }
.topnav #top-title { font-size: 15px; font-weight: 650; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menu-btn { display: none; }
.credit-chip b { color: var(--text); font-variant-numeric: tabular-nums; } .credit-chip .muted { font-weight: 500; }
.run-chip { border-color: rgba(108, 140, 255, .5); color: var(--accent-2); } .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
body.no-nav #side { display: none; }

@media (max-width: 860px) {
  #side { position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 300px); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.side-open #side { transform: none; } body.side-open #scrim { display: block; position: fixed; inset: 0; background: rgba(5, 8, 14, .55); z-index: 35; }
  body.side-folded #side { width: min(84vw, 300px); } body.side-folded .brand-t, body.side-folded #side-search, body.side-folded .side-t, body.side-folded .side-tag { display: revert; }
  body.side-folded .brand { display: flex; } body.side-folded .side-item { justify-content: flex-start; padding: 7px 10px; }
  #menu-btn { display: inline-grid; } .side-fold { display: none; }
  .topnav .credit-chip .muted { display: none; } .acct-btn .em { display: none; }
}

/* notification bell */
#top-notices { position: relative; display: inline-flex; align-items: center; }
.notice-bell { position: relative; }
.notice-bell.has { color: var(--accent, #6d7bff); }
.notice-n { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.notice-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(420px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto; z-index: 60; background: var(--panel, #1a1d27); border: 1px solid var(--line, #2c3040); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.notice-panel[hidden] { display: none; }
.notice-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line, #2c3040); }
.notice-paused { padding: 10px 14px; border-bottom: 1px solid var(--line, #2c3040); background: rgba(255, 176, 32, .08); }
.notice-card { padding: 12px 14px; border-bottom: 1px solid var(--line, #2c3040); display: grid; gap: 6px; }
.notice-card.read { opacity: .78; } .notice-card.done { opacity: .5; }
.notice-card.sev-error { border-left: 3px solid #e5484d; } .notice-card.sev-warn { border-left: 3px solid #f5a524; }
.notice-t { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; } .notice-t .muted { margin-left: auto; }
.notice-b { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted-fg, #aab); }

/* the section menu (shell.js) */
#side-nav { display: flex; flex-direction: column; }
#side-nav > .side-list { gap: 2px; margin-top: 4px; }
#side-nav .side-item { padding: 9px 10px; font-size: 14px; }
.side-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.side-results { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.side-item.sr { align-items: flex-start; } .side-item.sr .ic { margin-top: 2px; }
.side-item.sr .side-t { display: flex; flex-direction: column; white-space: normal; line-height: 1.25; }
.side-crumb { font-size: 11px; font-weight: 500; color: var(--faint); }
.side-none { padding: 10px; font-size: 13px; }
.top-sub { color: var(--muted); font-weight: 500; }
body.side-folded .side-crumb { display: none; }
body.side-folded .side-bottom { padding-top: 8px; }
@media (max-width: 860px) { .top-sub { display: none; } }
@media (max-width: 560px) {
  .topnav { gap: 4px; padding: 0 8px; } .topnav #top-title { display: none; }
  .act-btn-t, #top-brand .chip-btn span:not(.ic) { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .act-btn .act-btn-t { display: none; }
  .credit-chip .ic { display: none; } .credit-chip { padding: 5px 9px; }
}

/* EMBEDDED in the phone and tablet app (?embed=1): the app has its own menu, top bar and back button */
body.app-embed #side, body.app-embed #topnav, body.app-embed #scrim { display: none !important; }
body.app-embed main#app { margin-left: 0 !important; padding: 10px 12px 24px; max-width: none; }
body.app-embed .page { max-width: none; }
