/* Zeus AI app shell (Sprint 7b): sidebar, top bar, search, content area, sign-in pages.
   Desktop and tablet only (decision D10): at <= 1100px the sidebar collapses to icons. */
:root { --pad-y: var(--s-6); --pad-x: var(--s-7); }

#app { display: flex; height: 100vh; }

/* ---------- sidebar ---------- */
.app-sidebar { flex: 0 0 var(--sidebar-w); display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-3); background: var(--sidebar-bg); overflow-y: auto; transition: flex-basis var(--dur) var(--ease); }
.sb-brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-1) var(--s-2) var(--s-5); color: #fff; font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.sb-brand:hover { text-decoration: none; color: #fff; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; background: var(--brand-grad); color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .5); }
.brand-mark svg { width: 18px; height: 18px; fill: #fff; stroke: #fff; }
.brand-name small { display: block; margin-top: 1px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sidebar-text); }
.sb-section { padding: var(--s-4) var(--s-3) var(--s-1); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-300); opacity: .75; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-item { display: flex; align-items: center; gap: var(--s-3); height: 38px; padding: 0 var(--s-3); border-radius: var(--r-md); color: var(--sidebar-text); font-size: var(--fs-sm); font-weight: 550; border: 0; background: none; text-align: left; width: 100%; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.sb-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.sb-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--sidebar-accent); }
.sb-item .icon, .sb-item svg { width: 18px; height: 18px; opacity: .9; }
.sb-footer { margin-top: auto; padding-top: var(--s-4); }
.sb-user { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-md); background: var(--sidebar-hover); }
.sb-user-text { min-width: 0; flex: 1; }
.sb-user-text b { display: block; color: #fff; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-text small { display: block; color: var(--sidebar-text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-signout { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--r-sm); background: none; color: var(--sidebar-text); }
.sb-signout:hover { background: var(--sidebar-active); color: #fff; }

/* ---------- main column, top bar ---------- */
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
header { flex: 0 0 var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line); }
.hdr-inner { height: var(--topbar-h); padding: 0 var(--pad-x); display: flex; align-items: center; gap: var(--s-4); }
.hdr-date { margin-left: auto; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
#bodyArea { flex: 1; overflow-y: auto; padding: var(--pad-y) var(--pad-x); }
.page { max-width: var(--content-max); margin: 0 auto; }

.searchbox-wrap { position: relative; flex: 1; max-width: 480px; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); display: flex; pointer-events: none; }
.searchinput { width: 100%; height: 38px; padding: 0 44px 0 38px; background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--text); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.searchinput::placeholder { color: var(--text-3); }
.searchinput:hover { background: var(--n-100); }
.searchinput:focus { background: var(--surface); border-color: var(--accent); box-shadow: var(--ring); }
.searchbox-wrap kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-dropdown { display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40; max-height: 420px; overflow-y: auto; padding: var(--s-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-lg); }
.search-dropdown.open { display: block; }
.search-group { padding: var(--s-2) var(--s-3) 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.search-item { display: flex; flex-direction: column; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); color: var(--text); }
.search-item:hover { background: var(--accent-soft); text-decoration: none; }
.search-item b { font-size: var(--fs-sm); font-weight: 600; }
.search-item span { font-size: var(--fs-xs); color: var(--text-2); }
.search-empty { padding: var(--s-5); text-align: center; font-size: var(--fs-sm); color: var(--text-2); }

/* ---------- tablet: icon-only sidebar ---------- */
@media (max-width: 1100px) {
  :root { --pad-x: var(--s-5); }
  .app-sidebar { flex-basis: var(--sidebar-w-collapsed); align-items: center; padding-left: var(--s-2); padding-right: var(--s-2); }
  .brand-name, .sb-label, .sb-section, .sb-user-text, .sb-user .avatar + .sb-user-text { display: none; }
  .sb-brand { padding-left: 0; padding-right: 0; justify-content: center; }
  .sb-item { justify-content: center; padding: 0; width: 44px; }
  .sb-user { flex-direction: column; padding: var(--s-2); background: none; }
  .hdr-date { display: none; }
}

/* ---------- sign-in pages ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.1fr) minmax(420px, 1fr); background: var(--surface); }
.auth-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-8); padding: var(--s-8) 56px; color: #fff; overflow: hidden;
  background: radial-gradient(900px 500px at -10% -10%, rgba(139, 92, 246, .55), transparent 60%), radial-gradient(700px 500px at 110% 110%, rgba(99, 102, 241, .5), transparent 60%), var(--ink-900); }
.auth-aside .sb-brand { padding: 0; font-size: var(--fs-xl); }
.auth-aside h2 { color: #fff; font-size: 34px; letter-spacing: -.025em; line-height: 1.15; max-width: 420px; margin-bottom: var(--s-5); }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.auth-points li { display: flex; gap: var(--s-3); align-items: flex-start; color: var(--ink-100); font-size: var(--fs-md); }
.auth-points svg { width: 18px; height: 18px; margin-top: 2px; color: #8b8bff; }
.auth-foot { font-size: var(--fs-xs); color: var(--ink-300); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: var(--s-7); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: var(--fs-3xl); letter-spacing: -.025em; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: var(--s-6); }
.auth-brand-small { display: none; align-items: center; gap: var(--s-3); margin-bottom: var(--s-6); font-size: var(--fs-xl); font-weight: 700; }
.autherror { min-height: 1.2em; margin: 0 0 var(--s-3); color: var(--danger); font-size: var(--fs-sm); }
.ssobtn { display: flex; align-items: center; justify-content: center; gap: var(--s-2); width: 100%; height: 42px; margin-bottom: var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); font-weight: 600; font-size: var(--fs-sm); box-shadow: var(--sh-xs); }
.ssobtn:hover { background: var(--surface-2); }
.authdivider { display: flex; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-4); color: var(--text-3); font-size: var(--fs-xs); }
.authdivider::before, .authdivider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-brand-small { display: flex; }
}

.skip-link { position: absolute; left: var(--s-3); top: -48px; z-index: 100; padding: var(--s-2) var(--s-4); border-radius: var(--r-md); background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; transition: top var(--dur) var(--ease); }
.skip-link:focus { top: var(--s-3); outline: 0; box-shadow: var(--ring); }

/* ---------- signed-in user menu (Sprint 8b) ---------- */
.um { position: relative; padding: 0; }
.um-button { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: var(--s-3); border: 0; border-radius: var(--r-md); background: none; color: inherit; text-align: left; }
.um-button:hover { background: var(--sidebar-active); }
.um-caret { display: inline-flex; color: var(--sidebar-text); }
.um-menu { position: fixed; z-index: 70; display: flex; flex-direction: column; padding: var(--s-2); background: var(--ink-800); border: 1px solid var(--sidebar-active); border-radius: var(--r-lg); box-shadow: var(--sh-lg); }
.um-item { display: flex; align-items: center; gap: var(--s-3); width: 100%; height: 38px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-md); background: none; color: var(--ink-100); font-size: var(--fs-sm); font-weight: 550; text-align: left; text-decoration: none; }
.um-item:hover, .um-item:focus-visible { background: var(--sidebar-active); color: #fff; text-decoration: none; outline: 0; }
.um-item .icon { width: 16px; height: 16px; }
.um-danger { color: #ffb4ad; }
@media (max-width: 1100px) { .um-button { justify-content: center; padding: var(--s-2); } .um-caret { display: none; } }

/* The in-app bell (Sprint 8e) */
.bell { position: relative; margin-left: var(--s-3); flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text-2); cursor: pointer; position: relative; }
.icon-btn:hover { color: var(--text); border-color: var(--n-300); }
.bell-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-menu { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); z-index: 60; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.bell-list { list-style: none; margin: 0; padding: 0; }
.bell-item { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { border-left: 3px solid var(--accent); background: var(--surface-2); }
.bell-item span { color: var(--text-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.bell-item small { color: var(--text-2); }
.bell-empty { padding: var(--s-5); color: var(--text-2); text-align: center; }
