:root {
  --hal-sidebar-width: 292px;
  --hal-app-rail-width: var(--hal-sidebar-width);
  --hal-app-content-gutter: clamp(20px, 4vw, 64px);
  --hal-sidebar-surface-solid: color-mix(in srgb, #fff 72%, var(--bg-ink));
}

:root[data-theme="dark"] {
  --hal-sidebar-surface-solid: color-mix(in srgb, #0f172a 72%, var(--bg-ink));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --hal-sidebar-surface-solid: color-mix(in srgb, #0f172a 72%, var(--bg-ink));
  }
}

html {
  background: var(--bg-ink);
}

body {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100dvh;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden;
  background: var(--bg-ink) !important;
}

body::before,
body::after {
  display: none !important;
}

body > .shell {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100dvh;
  margin: 0 !important;
  padding: 0 0 48px var(--hal-app-rail-width) !important;
  transition: padding-left 180ms ease;
}

body > .shell > header {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 45;
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;
  width: var(--hal-app-rail-width);
  height: 100dvh;
  margin: 0;
  padding: 18px 14px 78px !important;
  border: 0 !important;
  border-right: 0 !important;
  border-radius: 0 !important;
  background: var(--surface-1) !important;
  box-shadow: none !important;
  transform: none !important;
  backdrop-filter: none !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

body > .shell > header button,
body > .shell > header a,
body > .shell > header input,
body > .shell > header select {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body > .shell > header a.brand,
body > .deck-app > .deck-topbar a.brand {
  text-decoration: none;
}

body > .shell > header .brand {
  flex: 0 0 auto;
  gap: 10px !important;
  width: 100%;
  min-width: 0;
  transform: none !important;
}

/* Show only the wordmark from the supplied artwork; the lens lives in the greeting. */
.brand .hal-brand-wordmark {
  display: block;
  flex: 0 0 auto;
  width: 54.4px;
  height: 25.6px;
  margin-left: 11px;
  overflow: hidden;
}

.brand .hal-brand-wordmark .hal-brand-logo {
  width: 105.6px;
  max-width: none;
  transform: translate(-50.4px, -8px);
}

body > .shell > header .brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 10px;
  color: #f8fafc;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 8px 18px rgba(101, 129, 244, 0.22);
}

body > .shell > header .brand h1,
body > .shell > header .brand strong {
  font-size: 19px;
  letter-spacing: 0;
}

body > .shell > header .brand > div > span,
body > .shell > header .brand-copy > span,
body > .shell > header .brand p {
  margin-top: 1px;
  overflow: hidden;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body > .shell > header .header-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  gap: 4px;
  width: 100%;
  margin: 0;
  transform: none !important;
}

body > .shell > header > .ghost-button,
body > .shell > header .header-actions > .ghost-button,
body > .shell > header .header-actions > button.ghost-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  background: var(--sidebar-nav-bg) !important;
  color: var(--text) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
}

body > .shell > header > .ghost-button svg,
body > .shell > header .header-actions > .ghost-button svg,
body > .shell > header .header-actions > button.ghost-button svg {
  margin-right: 4px;
}

body > .shell > header > .ghost-button:hover,
body > .shell > header .header-actions > .ghost-button:hover,
body > .shell > header .header-actions > button.ghost-button:hover {
  border-color: var(--line) !important;
  background: var(--surface-3) !important;
}

body > .shell > header #new-chat {
  order: -20;
}

body > .shell > header #back-to-chat-link {
  order: -19;
}

body > .shell > header .notification-wrap {
  position: absolute;
  top: 15px;
  right: 14px;
  z-index: 54;
  width: 34px;
}

body > .shell > header .notification-wrap .hidden {
  display: none !important;
}

body > .shell > header .notification-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 1px 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.68;
  transition: color 140ms ease, opacity 140ms ease, background 140ms ease;
}

body > .shell > header .notification-trigger svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.45;
}

body > .shell > header .notification-trigger:hover,
body > .shell > header .notification-trigger:focus-visible {
  background: var(--surface-3);
  color: var(--text);
  opacity: 0.9;
  outline: none;
}

body > .shell > header .notification-badge {
  position: absolute;
  top: 1px;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border: 2px solid var(--surface-1);
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

body > .shell > header .notification-menu {
  top: calc(100% + 8px);
  right: auto;
  left: 0;
  width: min(380px, calc(100vw - var(--hal-app-rail-width) - 28px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border: 1px solid var(--panel-border, var(--line));
  border-radius: 16px;
  background: var(--menu-bg, var(--surface-card));
  box-shadow: var(--shadow, 0 18px 40px rgba(15, 23, 42, 0.16));
}

body > .shell > header .notification-menu:not(.hidden) {
  display: grid;
}

body > .shell > header .notification-menu-head {
  padding: 13px 15px 10px;
  border-bottom: 1px solid var(--panel-border, var(--line));
}

body > .shell > header .notification-menu-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

body > .shell > header .notification-list {
  display: block;
  min-height: 0;
  overflow-y: auto;
}

body > .shell > header .notification-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 15px;
  border: 0;
  border-bottom: 1px solid var(--panel-border, var(--line));
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

body > .shell > header .notification-item:hover,
body > .shell > header .notification-item:focus-visible {
  background: var(--surface-3);
  outline: none;
}

body > .shell > header .notification-item.unread {
  background: var(--danger-soft, rgba(220, 38, 38, 0.08));
}

body > .shell > header .notification-item-title {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

body > .shell > header .notification-item-type {
  color: var(--accent-2, var(--accent));
}

body > .shell > header .notification-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

body > .shell > header .notification-empty,
body > .shell > header .notification-status {
  padding: 14px 15px;
  color: var(--muted);
  font-size: 12px;
}

body > .shell > header .notification-status.error {
  color: var(--danger-text, #b91c1c);
}

body > .shell > header .hal-sidebar-nav,
body > .deck-app > .deck-topbar .hal-sidebar-nav {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  margin-top: 10px !important;
  padding: 0 0 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body > .shell > header .hal-sidebar-nav::-webkit-scrollbar,
body > .deck-app > .deck-topbar .hal-sidebar-nav::-webkit-scrollbar {
  display: none;
}

.hal-sidebar-section {
  min-width: 0;
}

.hal-sidebar-section[hidden] {
  display: none !important;
}

.hal-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 8px 2px;
}

.hal-sidebar-head h2 {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.05em;
  opacity: 0.56;
  text-transform: uppercase;
}

.hal-sidebar-all {
  line-height: 1.4;
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.hal-sidebar-section:hover .hal-sidebar-all,
.hal-sidebar-section:focus-within .hal-sidebar-all {
  opacity: 0.76;
  pointer-events: auto;
  transform: none;
}

.hal-sidebar-all:hover,
.hal-sidebar-all:focus-visible {
  opacity: 1;
}

/* Available before the scheduled module loads, avoiding an unstyled placeholder. */
.hal-sidebar-nav .scheduled-sidebar-empty {
  margin: 0;
  padding: 5px 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}

.hal-sidebar-list {
  display: grid;
  gap: 0;
}

.hal-sidebar-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
}

.hal-sidebar-item:hover,
.hal-sidebar-item:focus-visible,
.hal-sidebar-item.is-active {
  background: var(--surface-3);
  outline: none;
}

.hal-sidebar-copy {
  min-width: 0;
}

.hal-sidebar-title,
.hal-sidebar-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hal-sidebar-title {
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}

.hal-sidebar-item.is-active .hal-sidebar-title {
  font-weight: 500;
}

.hal-sidebar-meta {
  margin-top: 2px;
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10.5px;
  font-weight: 300;
  line-height: 1.35;
}

.hal-sidebar-tag {
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 9px;
  font-weight: 400;
  white-space: nowrap;
}

.hal-sidebar-empty {
  padding: 8px 9px;
  color: var(--muted);
  font-size: 12px;
}

.hal-sidebar-prompt {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell-primary-link.is-active {
  background: var(--surface-3) !important;
}

.app-shell-page-tools {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
}

.app-shell-page-tools > * {
  width: 100%;
}

.app-shell-user-menu [hidden],
.app-shell-user-menu .hidden {
  display: none !important;
}

.app-shell-user-menu .user-menu-panel {
  position: absolute;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--menu-bg);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.app-shell-user-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.app-shell-user-menu .menu-item svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.app-shell-user-menu .menu-item:hover,
.app-shell-user-menu .menu-item:focus-visible {
  background: var(--surface-3);
  outline: none;
}

.app-shell-user-menu .menu-divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--line);
}

.app-shell-user-menu .menu-version {
  padding: 5px 10px 2px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (hover: none) {
  .hal-sidebar-all {
    opacity: 0.76;
    pointer-events: auto;
    transform: none;
  }
}

body > .shell > header .user-menu {
  position: fixed;
  left: 12px;
  bottom: 7px;
  z-index: 52;
  width: calc(var(--hal-app-rail-width) - 24px);
  margin: 0;
  background: var(--hal-sidebar-surface-solid);
}

body > .shell > header .user-menu::before,
body > .deck-app > .deck-topbar .user-menu::before,
body > .shell > header .header-actions > .user-trigger:last-child::before {
  content: "";
  position: absolute;
  top: -8px;
  right: -12px;
  left: -12px;
  height: 8px;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--line) 72%, transparent) 0 1px,
    var(--hal-sidebar-surface-solid) 1px 100%
  );
  pointer-events: none;
}

body > .shell > header .user-menu::after,
body > .deck-app > .deck-topbar .user-menu::after,
body > .shell > header .header-actions > .user-trigger:last-child::after {
  content: "";
  position: absolute;
  top: 100%;
  right: -12px;
  left: -12px;
  height: 7px;
  background: var(--hal-sidebar-surface-solid);
  pointer-events: none;
}

body > .shell > header .user-trigger,
body > .shell > header .header-actions > .user-trigger:last-child {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 5px 10px !important;
  border: 1px solid transparent !important;
  border-radius: 11px !important;
  background: transparent !important;
  color: var(--text) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 13px;
  font-weight: 400;
  box-shadow: none;
  backdrop-filter: none;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

body > .shell > header .header-actions > .user-trigger:last-child {
  position: fixed;
  left: 12px;
  bottom: 7px;
  z-index: 52;
  width: calc(var(--hal-app-rail-width) - 24px);
}

body > .shell > header .user-trigger:hover,
body > .shell > header .header-actions > .user-trigger:last-child:hover {
  border-color: var(--line) !important;
  background: var(--surface-3) !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.055);
}

body > .shell > header .user-trigger .chevron,
body > .deck-app > .deck-topbar .user-trigger .chevron {
  margin-left: auto;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-1px);
  transition: opacity 120ms ease;
}

body > .shell > header .user-trigger:hover .chevron,
body > .shell > header .user-trigger:focus-visible .chevron,
body > .shell > header .user-trigger[aria-expanded="true"] .chevron,
body > .deck-app > .deck-topbar .user-trigger:hover .chevron,
body > .deck-app > .deck-topbar .user-trigger:focus-visible .chevron,
body > .deck-app > .deck-topbar .user-trigger[aria-expanded="true"] .chevron {
  opacity: 0.72;
}

.user-avatar {
  display: inline-flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  overflow: hidden;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-3));
  color: var(--text);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.user-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-trigger > :not(.user-avatar):not(.chevron) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body > .shell > header .user-menu-panel {
  top: auto;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-height: min(540px, calc(100dvh - 82px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body > .shell > :not(header) {
  width: auto !important;
  max-width: none !important;
  margin: 24px var(--hal-app-content-gutter) 0 !important;
}

body > .shell > :not(header) + :not(header) {
  margin-top: 18px !important;
}

body > .shell > main.main {
  min-width: 0;
}

body > .shell > .panel,
body > .shell > .hero,
body > .shell > main.main > .panel,
body > .shell > main.main > .toolbar {
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
}

/* The meeting route is a full-screen deck rather than a standard shell, but
   it still uses the same left rail and right-side workspace relationship. */
body > .deck-app {
  width: 100% !important;
  min-height: 100dvh;
  padding-left: var(--hal-app-rail-width) !important;
  background: var(--bg-ink);
  transition: padding-left 180ms ease;
}

body > .deck-app > .deck-topbar {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 45;
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 18px;
  width: var(--hal-app-rail-width);
  height: 100dvh;
  padding: 18px 14px 78px !important;
  border: 0 !important;
  border-right: 0 !important;
  border-radius: 0 !important;
  background: var(--surface-1) !important;
  box-shadow: none !important;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

body > .deck-app > .deck-topbar .brand {
  width: 100%;
}

body > .deck-app > .deck-topbar .header-actions {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
}

body > .deck-app > .deck-topbar .header-actions > .ghost-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--sidebar-nav-bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  text-decoration: none;
}

body > .deck-app > .deck-topbar .header-actions > .ghost-button:hover {
  border-color: var(--line);
  background: var(--surface-3);
}

body > .deck-app > .deck-topbar .header-actions > .ghost-button svg {
  margin-right: 4px;
}

body > .deck-app > .deck-topbar .user-menu {
  position: fixed;
  left: 12px;
  bottom: 7px;
  z-index: 52;
  width: calc(var(--hal-app-rail-width) - 24px);
  background: var(--hal-sidebar-surface-solid);
}

body > .deck-app > .deck-topbar .user-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

body > .deck-app > .deck-topbar .user-trigger:hover {
  border-color: var(--line);
  background: var(--surface-3);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.055);
}

body > .deck-app > .deck-topbar .user-menu-panel {
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  width: 100%;
}

body > .deck-app > .deck-topbar .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 19px;
}

body > .deck-app > .deck-topbar .deck-controls {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 8px;
  width: 100%;
}

body > .deck-app > .deck-topbar .deck-controls .nav-button:not(.icon-button) {
  grid-column: 1 / -1;
  justify-content: center;
  width: 100%;
}

body > .deck-app > .slide-viewport {
  min-height: 100dvh;
  padding: var(--hal-app-content-gutter) !important;
}

.hal-sidebar-toggle {
  position: fixed;
  top: 15px;
  left: calc(var(--hal-sidebar-width) - 86px);
  z-index: 70;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.68;
  appearance: none;
  transition: left 180ms ease, color 140ms ease, opacity 140ms ease;
}

.hal-sidebar-toggle svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.45;
  transform: translateY(-1px);
}

.hal-sidebar-toggle:hover,
.hal-sidebar-toggle:focus-visible {
  color: var(--text);
  background: transparent;
  opacity: 0.9;
  outline: none;
}

.hal-sidebar-resizer {
  position: fixed;
  inset: 0 auto 0 calc(var(--hal-sidebar-width) - 4px);
  z-index: 65;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
  transition: left 180ms ease, opacity 140ms ease;
}

/* Keep the resize affordance behind an open notification surface. The handle's
   shadow otherwise crosses the menu and makes its opaque background look translucent. */
body:has(.notification-menu:not(.hidden)) > .hal-sidebar-resizer,
body:has(.notification-modal:not(.hidden)) > .hal-sidebar-resizer {
  z-index: 44;
}

.hal-sidebar-resizer::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 3px;
  width: 1px;
  background: transparent;
  box-shadow: none;
  transition: width 120ms ease, background 120ms ease;
}

.hal-sidebar-resizer::after {
  content: "";
  position: absolute;
  inset: 0 4px 0 auto;
  width: 15px;
  pointer-events: none;
  background: linear-gradient(
    to left,
    rgba(15, 23, 42, 0.8) 0%,
    rgba(15, 23, 42, 0.045) 0.3px,
    rgba(15, 23, 42, 0.018) 48%,
    rgba(15, 23, 42, 0) 100%
  );
}

.hal-sidebar-resizer:hover::before,
.hal-sidebar-resizer:focus-visible::before,
.hal-sidebar-resizing .hal-sidebar-resizer::before {
  width: 2px;
  background: var(--accent);
}

body.hal-sidebar-resizing,
body.hal-sidebar-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.hal-sidebar-resizing > .shell,
body.hal-sidebar-resizing > .deck-app,
body.hal-sidebar-resizing > .shell > header,
body.hal-sidebar-resizing > .deck-app > .deck-topbar,
body.hal-sidebar-resizing .hal-sidebar-toggle,
body.hal-sidebar-resizing .hal-sidebar-resizer {
  transition: none !important;
}

html.hal-sidebar-collapsed body > .shell,
html.hal-sidebar-collapsed body > .deck-app {
  padding-left: 0 !important;
}

html.hal-sidebar-collapsed body > .shell > header,
html.hal-sidebar-collapsed body > .deck-app > .deck-topbar {
  pointer-events: none;
  box-shadow: none !important;
  transform: translateX(calc(-1 * var(--hal-sidebar-width))) !important;
}

html.hal-sidebar-collapsed .hal-sidebar-toggle {
  left: 14px;
  background: transparent;
  box-shadow: none;
  opacity: 0.68;
}

html.hal-sidebar-collapsed .hal-sidebar-resizer {
  pointer-events: none;
  opacity: 0;
}

@media (max-width: 900px) {
  :root {
    --hal-sidebar-width: 252px;
    --hal-app-rail-width: var(--hal-sidebar-width);
    --hal-app-content-gutter: 28px;
  }
}

@media (max-width: 720px) {
  :root {
    --hal-app-content-gutter: 14px;
  }

  body > .shell,
  body > .deck-app {
    min-height: 100dvh;
    padding-left: 0 !important;
  }

  body > .shell > header,
  body > .deck-app > .deck-topbar {
    position: sticky !important;
    inset: 0 auto auto;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: auto;
    padding: 10px 12px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    background: color-mix(in srgb, var(--bg-ink) 90%, transparent) !important;
    backdrop-filter: blur(16px) !important;
  }

  body > .shell > header .brand,
  body > .deck-app > .deck-topbar .brand {
    width: auto;
    margin-right: auto;
  }

  body > .shell > header .brand > div > span,
  body > .shell > header .brand-copy > span,
  body > .shell > header .brand p,
  body > .deck-app > .deck-topbar .brand-copy > span {
    display: none;
  }

  body > .shell > header .header-actions {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    width: auto;
    margin: 0;
  }

  body > .deck-app > .deck-topbar .header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    width: auto;
  }

  body > .shell > header > .ghost-button,
  body > .shell > header .header-actions > .ghost-button,
  body > .shell > header .header-actions > button.ghost-button,
  body > .deck-app > .deck-topbar .header-actions > .ghost-button {
    width: auto;
    min-height: 34px;
    padding: 7px 9px !important;
    font-size: 12px;
  }

  body > .shell > header .notification-wrap {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
  }

  body > .shell > header .notification-menu {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: min(380px, calc(100vw - 24px));
  }

  body > .shell > header .user-menu {
    position: static;
    left: auto;
    bottom: auto;
    width: auto;
  }

  body > .deck-app > .deck-topbar .user-menu {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
  }

  body > .shell > header .user-menu::before,
  body > .deck-app > .deck-topbar .user-menu::before,
  body > .shell > header .header-actions > .user-trigger:last-child::before,
  body > .shell > header .user-menu::after,
  body > .deck-app > .deck-topbar .user-menu::after,
  body > .shell > header .header-actions > .user-trigger:last-child::after {
    display: none;
  }

  body > .shell > header .user-trigger,
  body > .shell > header .header-actions > .user-trigger:last-child,
  body > .deck-app > .deck-topbar .user-trigger {
    position: static;
    width: auto;
    height: 34px;
    min-height: 34px;
    padding: 7px 9px !important;
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none;
    backdrop-filter: none;
  }

  body > .shell > header .user-trigger .chevron {
    display: none;
  }

  body > .shell > header .user-menu-panel {
    top: calc(100% + 8px);
    right: 12px;
    bottom: auto;
    left: auto;
    width: min(268px, calc(100vw - 24px));
    max-height: calc(100dvh - 72px);
  }

  body > .deck-app > .deck-topbar .user-menu-panel {
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    left: auto;
    width: min(268px, calc(100vw - 24px));
  }

  body > .shell > header .hal-sidebar-nav,
  body > .deck-app > .deck-topbar .hal-sidebar-nav,
  .app-shell-page-tools {
    display: none !important;
  }

  body > .shell > :not(header) {
    margin: 18px var(--hal-app-content-gutter) 0 !important;
  }

  body > .deck-app > .deck-topbar .deck-controls {
    display: flex;
    width: auto;
  }

  body > .deck-app > .deck-topbar .deck-controls .nav-button:not(.icon-button) {
    width: auto;
  }

  body > .deck-app > .slide-viewport {
    padding: var(--hal-app-content-gutter) !important;
  }

  .hal-sidebar-toggle,
  .hal-sidebar-resizer {
    display: none !important;
  }
}

@media (max-width: 480px) {
  body > .shell > header,
  body > .deck-app > .deck-topbar {
    flex-wrap: wrap;
  }

  body > .shell > header .header-actions,
  body > .deck-app > .deck-topbar .deck-controls {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body > .shell > header .header-actions::-webkit-scrollbar,
  body > .deck-app > .deck-topbar .deck-controls::-webkit-scrollbar {
    display: none;
  }
}

/* Shared sidebar notification reader, matching the chat reader. */
.app-shell-notification-modal.notification-modal {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg-ink) 62%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: clamp(14px, 3vw, 34px);
}

.app-shell-notification-modal .notification-modal-panel {
  width: min(1040px, 96vw);
  height: min(820px, 92vh);
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  background: var(--menu-bg, var(--bg-ink));
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-shell-notification-modal .notification-modal-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  padding: clamp(18px, 3vw, 30px);
  border-bottom: 1px solid var(--panel-border);
}

.app-shell-notification-modal .notification-modal-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.app-shell-notification-modal .notification-modal-head h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.app-shell-notification-modal .notification-modal-close {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.app-shell-notification-modal .notification-modal-body {
  overflow: auto;
  padding: clamp(18px, 3vw, 34px);
  font-size: 16px;
  line-height: 1.65;
}

.app-shell-notification-modal .notification-modal-body > *:first-child {
  margin-top: 0;
}

.app-shell-notification-modal .notification-modal-body h1,
.app-shell-notification-modal .notification-modal-body h2,
.app-shell-notification-modal .notification-modal-body h3,
.app-shell-notification-modal .notification-modal-body h4 {
  margin: 28px 0 10px;
  line-height: 1.18;
  letter-spacing: 0;
}

.app-shell-notification-modal .notification-modal-body p,
.app-shell-notification-modal .notification-modal-body ul,
.app-shell-notification-modal .notification-modal-body ol,
.app-shell-notification-modal .notification-modal-body blockquote,
.app-shell-notification-modal .notification-modal-body table,
.app-shell-notification-modal .notification-modal-body pre {
  margin: 0 0 18px;
}

.app-shell-notification-modal .notification-modal-body img {
  display: block;
  width: auto;
  max-width: min(100%, 880px);
  height: auto;
  max-height: 58vh;
  object-fit: contain;
  margin: 20px auto;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--surface-2, transparent);
}

.app-shell-notification-modal .notification-modal-body a {
  color: var(--link);
}

.app-shell-notification-modal .notification-modal-body code {
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.14);
  padding: 2px 5px;
}

.app-shell-notification-modal .notification-modal-body pre {
  overflow: auto;
  border-radius: 12px;
  background: var(--surface-2, rgba(148, 163, 184, 0.12));
  padding: 14px;
}

.app-shell-notification-modal .notification-modal-body pre code {
  background: transparent;
  padding: 0;
}

.app-shell-notification-modal .notification-modal-body blockquote {
  border-left: 3px solid rgba(56, 189, 248, 0.7);
  padding-left: 14px;
  color: var(--muted);
}

.app-shell-notification-modal .notification-modal-body table {
  width: 100%;
  border-collapse: collapse;
}

.app-shell-notification-modal .notification-modal-body th,
.app-shell-notification-modal .notification-modal-body td {
  border: 1px solid var(--panel-border);
  padding: 8px 10px;
  text-align: left;
}


.app-shell-notification-modal.hidden { display: none; }
