/* shell.css — app frame for every signed-in page: icon rail (injected by core/shell.js) + page area.
   Pages keep their own .chat-app wrapper; the rail sits beside it. */

body.has-rail { display: flex; height: 100vh; height: 100dvh; overflow: hidden; background: var(--canvas); }
body.has-rail > .chat-app, body.has-rail > .cx-app { flex: 1; min-width: 0; }

/* ---- icon rail ---- */
.rail { width: var(--rail-width); flex-shrink: 0; background: var(--rail); border-right: 1px solid var(--hair); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 18px; z-index: 90; }
.rail-brand { width: 38px; height: 38px; border-radius: 11px; background: var(--emerald); display: grid; place-items: center; box-shadow: var(--shadow-accent); flex-shrink: 0; }
.rail-stack { display: flex; flex-direction: column; gap: 6px; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }

.rail-link { position: relative; width: 40px; height: 40px; border-radius: 11px; border: 1px solid transparent; color: var(--muted); display: grid; place-items: center; text-decoration: none; transition: background .15s, color .15s; }
.rail-link:hover { background: rgba(19, 24, 21, 0.06); color: var(--ink); }
.rail-link.active { background: var(--tint); border-color: var(--tint-border); color: var(--emerald-deep); }
.rail-link::after { content: attr(data-label); position: absolute; left: 50px; top: 50%; transform: translateY(-50%); background: var(--ink); color: #fff; font-size: 12px; font-weight: 500; padding: 4px 9px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5; }
.rail-link:hover::after, .rail-link:focus-visible::after { opacity: 1; }

/* account menu (ids are bound by each page's script: user-menu-btn, session-label, ...) */
.user-menu { position: relative; flex-shrink: 0; }
.user-avatar-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #cfe9da; color: #0b5a37; display: grid; place-items: center; cursor: pointer; padding: 0; box-shadow: none; }
.user-avatar-btn:hover, .user-avatar-btn[aria-expanded='true'] { background: #bfe0cd; }
.user-avatar { font-size: 13px; font-weight: 700; text-transform: uppercase; }
.user-menu-dropdown { position: absolute; left: 46px; bottom: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; z-index: 120; }
.user-menu-email { margin: 2px 4px 6px; padding: 8px 8px 10px; border-bottom: 1px solid var(--hair); font-size: 12.5px; font-weight: 500; color: var(--muted); word-break: break-all; }
.user-menu-logout { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--danger); font-weight: 600; font-size: 0.86rem; cursor: pointer; box-shadow: none; text-align: left; }
.user-menu-logout:hover { background: var(--danger-tint); }

/* ---- page header (light; replaces the old navy bar) ---- */
.chat-app { display: flex; flex-direction: column; height: 100dvh; max-height: 100dvh; background: var(--canvas); min-width: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; min-height: 56px; border-bottom: 1px solid var(--hair); background: var(--canvas); flex-shrink: 0; z-index: 10; }
.chat-header-start, .chat-header-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-header-end { flex-shrink: 0; }
.admin-page-title, .page-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin: 0; }
.ghost-link { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 9px; font-size: 0.85rem; font-weight: 600; text-decoration: none; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.ghost-link:hover { background: var(--chip); color: var(--ink); }
.chat-header .secondary-btn { padding: 7px 13px; }

/* brand (used on public pages and in the mobile drawer) */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--emerald); color: #fff; box-shadow: var(--shadow-accent); }

/* ---- small screens: the rail becomes a drawer opened from the header ---- */
.rail-toggle { display: none; width: 34px; height: 34px; padding: 0; border-radius: 10px; background: var(--emerald); place-items: center; box-shadow: var(--shadow-accent); flex-shrink: 0; }
.rail-backdrop { display: none; }
@media (max-width: 900px) {
  .rail { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  body.rail-open .rail { transform: translateX(0); }
  body.rail-open .rail-backdrop { display: block; position: fixed; inset: 0; background: rgba(19, 24, 21, .35); z-index: 80; }
  .rail-toggle { display: inline-grid; }
  .chat-header { padding: 10px 14px; }
}
