:root {
  color-scheme: light;
  --rail-width: 14.75rem;
  --reading-width: 64rem;
  --shell-bg: #e9ebef;
  --panel-bg: linear-gradient(180deg, #f8f9fa 0%, #f2f3f6 100%);
  --text: #293342;
  --muted: #4c5a6d;
  font: 100%/1.5 Inter, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--shell-bg); color: var(--text); }
button, a { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; }
a { text-decoration: none; }
:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 5; inset: .5rem auto auto .5rem; transform: translateY(-160%); border-radius: .4rem; padding: .5rem .75rem; background: white; }
.skip-link:focus { transform: none; }
.advisor-shell { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.history-rail { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--shell-bg); }
.history-viewport { position: relative; flex: 1; min-height: 0; overflow: hidden; overflow: clip; }
iframe { display: block; border: 0; }
/* The published Dify list occupies the first 14.75rem of its desktop view. */
#history-frame { position: absolute; inset: 0 auto 0 0; width: 48rem; height: 100%; }
.history-tools, .college-links { flex: none; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .25rem .75rem; }
.history-tools { color: var(--muted); gap: .15rem; padding-inline: .5rem; }
.college-links { border-top: 1px solid #d8dde5; padding-block: .35rem max(.4rem, env(safe-area-inset-bottom)); }
.history-tools :is(a, button), .college-links a, .drawer-top button, .mobile-bar button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.25rem;
  border-radius: .45rem; padding: .25rem .45rem; background: transparent; font-size: .875rem; white-space: nowrap;
}
.history-tools :is(a, button):hover, .college-links a:hover, .drawer-top button:hover, .mobile-bar button:hover { background: #dce1e9; }
.history-tools button { padding-inline: .3rem; }
.chat-panel { min-width: 0; min-height: 0; margin: .5rem .5rem .5rem 0; overflow: hidden; display: flex; flex-direction: column; background: var(--panel-bg); border-radius: 1rem; }
.chat-column { position: relative; width: min(90%, var(--reading-width)); min-height: 0; flex: 1; margin-inline: auto; }
#chat-frame { width: 100%; height: 100%; }
#loading { position: absolute; inset: 45% 0 auto; text-align: center; color: var(--muted); pointer-events: none; }
.drawer-top, .mobile-bar, #history-backdrop, .provider-link { display: none; }
.history-heading-actions { display: flex; align-items: center; gap: .75rem; }
@media (min-width: 52rem) and (max-width: 72rem) {
  .chat-column { width: min(calc(100% - 1.5rem), var(--reading-width)); }
}
@media (max-width: 51.99rem) {
  .advisor-shell { grid-template-columns: minmax(0, 1fr); }
  .history-rail { position: fixed; z-index: 3; inset: 0 auto 0 0; width: min(var(--rail-width), 90vw); visibility: hidden; }
  .advisor-shell.history-open .history-rail { visibility: visible; box-shadow: 4px 0 24px rgb(25 38 59 / 14%); }
  #history-backdrop:not([hidden]) { display: block; position: fixed; z-index: 2; inset: 0; background: rgb(27 39 54 / 30%); }
  .drawer-top, .mobile-bar { display: flex; align-items: center; min-height: 3rem; gap: .75rem; padding: .25rem .7rem; }
  .drawer-top { justify-content: space-between; border-bottom: 1px solid #d8dde5; }
  .mobile-bar { flex: none; border-bottom: 1px solid #e0e4e9; background: #f8f9fa; }
  .mobile-bar h1 { margin: 0; font-size: 1rem; font-weight: 600; }
  .mobile-bar button, .drawer-top button { background: white; border: 1px solid #d6dce4; padding-inline: .65rem; }
  .chat-panel { margin: 0; border-radius: 0; }
  .chat-column { width: 100%; }
}

/* Full history lets keyboard users navigate the complete native page without clipping. */
.advisor-shell.history-full .history-rail { position: fixed; z-index: 4; inset: 0; width: 100%; visibility: visible; }
.history-full .drawer-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3rem; padding: .25rem .85rem; border-bottom: 1px solid #d8dde5; }
.history-full .drawer-top button { background: white; border: 1px solid #d6dce4; padding-inline: .65rem; }
.history-full .provider-link { display: inline; font-size: .875rem; text-decoration: underline; text-underline-offset: .15em; }
.history-full #history-frame { width: 100%; }
.history-full .history-tools, .history-full .college-links { display: none; }
