/* Shared workspace and question-only shell, bundled with every client. */
:root { --bg: #f5f6f8; --line: #e4e9e7; --ink: #182f2b; --muted: #61746e; --radius: 20px; }
body { -webkit-font-smoothing: antialiased; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { transition: background .15s, box-shadow .15s; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #a89452; outline-offset: 3px; }
.sidebar { width: 260px; padding: 30px 20px 20px; background: linear-gradient(165deg, #123f37, #082c27); overflow-y: auto; z-index: 20; }
.brand { padding: 0 9px 22px; border-bottom: 1px solid #ffffff18; }
.brand-logo { width: 104px; }
.sidebar-label { margin: 23px 13px 8px; color: #97b4aa; font-size: 9px; letter-spacing: 1.8px; }
.nav { border-radius: 11px; padding: 11px 12px; margin: 3px 0; font-size: 18px; color: #c9d9d3; gap: 13px; min-height: 43px; }
.nav span { font-size: 12px; font-weight: 500; }
.nav:hover { background: #ffffff0c; }
.nav.active { color: #fcf6e1; background: #ffffff12; box-shadow: inset 3px 0 var(--gold); }
.local-note { border-top: 1px solid #ffffff15; margin-top: 24px; padding: 18px 10px 8px; }
.mode-switch { margin-top: 22px; background: #d6c58f; color: #103b32; font-size: 11px; padding: 13px 10px; }
#nav-toggle { display: none; }
main { margin-left: 260px; width: calc(100% - 260px); padding: 36px clamp(22px, 3vw, 54px) 24px; max-width: 1900px; }
header { margin-bottom: 27px; align-items: flex-start; }
h1 { font-size: clamp(25px, 2.8vw, 36px); font-weight: 650; letter-spacing: -1.2px; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-weight: 600; }
#page-description { margin: 10px 0 0; font-size: 13px; max-width: 560px; }
.eyebrow { font-size: 9px; letter-spacing: 1.8px; }
.header-right { display: grid; grid-template-columns: minmax(130px, 250px) 42px; gap: 6px 9px; flex-shrink: 0; }
.header-right label { grid-column: 1 / -1; font-size: 10px; font-weight: 600; color: var(--muted); }
.header-right select { width: 100%; max-width: 250px; padding: 12px; }
#session-info { margin: 0 0 7px; font-size: 11px; }
#collection-info { margin: 0 0 23px; font-size: 11px; color: #536c61; }
.panel { border: 1px solid var(--line); box-shadow: 0 4px 20px #173a3404; padding: 28px; }
.primary { background: #074b40; box-shadow: 0 2px 3px #003f3712; }
.primary:hover:not(:disabled) { background: #086451; }
.secondary { background: #fff; border: 1px solid #dbe3df; color: var(--green); }
.secondary:hover:not(:disabled) { background: #f2f6f3; }
.hero { position: relative; background: radial-gradient(ellipse at 85% 0, #306957 0, #154c40 35%, #083d33 80%); padding: 36px; min-height: 270px; }
.hero h2 { font-size: clamp(28px, 3vw, 40px); font-weight: 550; }
.hero p { color: #d0dfd8; max-width: 430px; }
.stats article { border: 1px solid var(--line); box-shadow: none; }
.stats strong { font-size: 38px; font-weight: 550; }
.dropzone { background: #f8faf8; border: 1px dashed #c3d3c9; padding: 22px; gap: 12px; }
.upload-choice { padding: 22px; border-radius: 14px; box-shadow: 0 2px 5px #003f3704; }
.upload-choice label { font-size: 15px; }
.upload-choice input::file-selector-button { font-size: 12px; }
#upload-form > p { margin: 4px 0 8px; }
#batch-target { width: 100%; font-weight: 600; color: var(--green); }
#batch-pause, #batch-retry { background: white; border: 1px solid var(--line); font-size: 12px; }
th { background: #f7f9f7; padding: 14px; }
td { padding: 16px 14px; font-size: 13px; }
tbody tr:hover { background: #f9fbf9; }
#notice { border: 1px solid #cfdbd2; border-left: 4px solid var(--green); border-radius: 12px; background: #edf4ee; padding: 15px 19px; margin-bottom: 20px; overflow-wrap: anywhere; }
#chat-unavailable { padding: 18px; background: #f4efe0; border-radius: 12px; }
.chat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 18px; }
.chat-toolbar p { margin: 5px 0 0; }
#new-question { white-space: nowrap; font-size: 12px; }
.chat-layout { display: flex; flex-direction: column; gap: 14px; }
.chat-panel { padding: 26px 30px 20px; min-height: 550px; margin: 0; }
.chat-panel .section-head { padding-bottom: 17px; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.chat-panel h2 { font-size: 16px; margin: 0; }
.badge { background: #edf4ef; color: #3c6956; border: 1px solid #dde9df; font-size: 10px; padding: 6px 10px; }
#messages { min-height: 270px; max-height: 55vh; padding: 16px 0; scrollbar-width: thin; }
.chat-welcome { max-width: 650px; margin: auto; padding: 23px 10px 20px; }
.chat-welcome .assistant-spark { display: grid; place-items: center; background: #f5f2e6; color: #8a7540; width: 62px; height: 62px; border-radius: 20px; font-size: 32px; margin: 0 auto 18px; }
.chat-welcome h3 { font-size: clamp(20px, 2vw, 26px); margin: 0 0 9px; letter-spacing: -.6px; }
.chat-welcome p { font-size: 13px; max-width: 420px; margin: 0 auto 22px; }
.prompt-choices { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.prompt-choices button { text-align: left; border: 1px solid var(--line); background: #fff; font-size: 11px; color: #47645a; padding: 10px 13px; font-weight: 450; }
.prompt-choices button:hover { background: #f2f6f3; }
.message { background: #f3f6f4; border: 1px solid #e6ece8; border-radius: 16px 16px 16px 4px; padding: 20px 22px; max-width: 92%; }
.message.user { background: #164e41; color: #fff; border: 0; margin-left: auto; border-radius: 16px 16px 4px 16px; max-width: 82%; }
#chat-form { background: #f9faf9; border: 1px solid #dbe4de; padding: 8px; border-radius: 16px; margin: 0 0 10px; align-items: flex-end; }
#chat-form:focus-within { border-color: #658d76; box-shadow: 0 0 0 3px #e7eee8; }
#question { border: 0; background: transparent; padding: 14px 12px; min-height: 76px; max-height: 200px; }
#question:focus { outline: none; }
#send { margin: 3px; min-height: 44px; font-size: 12px; }
.sources-panel { margin: 0; padding: 20px 26px; }
.sources-panel > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
#source-count { border-radius: 20px; padding: 3px 9px; background: #eef3ef; margin-left: 8px; font-size: 11px; }
.source { padding: 14px 0; }
#sources > p { margin: 15px 0 0; }
/* Login is a focused entry screen, with no inactive admin navigation. */
.signed-out .sidebar nav, .signed-out .sidebar .local-note, .signed-out #logout, .signed-out #nav-toggle, .signed-out #simple-mode, .signed-out .header-right { display: none !important; }
.signed-out .sidebar { justify-content: center; }
.signed-out .brand { border: 0; flex-wrap: wrap; justify-content: center; }
.signed-out main { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; }
.signed-out header { max-width: 860px; width: 100%; margin: 0 auto 30px; }
#login { max-width: 860px; width: 100%; padding: 38px; margin: 0 auto 20px; gap: 24px; }
#login h2 { font-size: 30px; line-height: 1.2; letter-spacing: -1px; margin-top: 12px; }
#password-login-form { display: grid; gap: 10px; }
#password-login-form label { font-size: 12px; font-weight: 600; }
#password-login-form button { margin-top: 8px; }
#login > details { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 18px; }
#login > details summary { font-size: 12px; color: var(--muted); cursor: pointer; }
#login-form { padding-top: 18px; }
/* A compact app for colleagues who only ask questions. */
.assistant-mode { display: block; }
.assistant-mode .sidebar { position: relative; inset: auto; width: 100%; padding: 17px max(24px, calc((100vw - 1140px) / 2)); flex-direction: row; align-items: center; gap: 18px; overflow: visible; }
.assistant-mode .brand { padding: 0; border: 0; margin-right: auto; }
.assistant-mode .brand-logo { width: 84px; }
.assistant-mode .brand small { font-size: 8px; }
.assistant-mode #nav-toggle { display: block; font-size: 11px; padding: 10px 14px; background: #ffffff10; color: white; border-color: #ffffff24; }
.assistant-mode .sidebar nav { display: none; position: absolute; right: 24px; top: 68px; padding: 10px; width: 260px; background: #133e35; border-radius: 12px; box-shadow: 0 15px 40px #122f3330; z-index: 30; }
.assistant-mode.nav-open .sidebar nav { display: block; }
.assistant-mode .sidebar-label { display: none; }
.assistant-mode .local-note { display: none; }
.assistant-mode .mode-switch { margin: 0; padding: 10px; }
.assistant-mode .logout { padding: 10px 0; white-space: nowrap; color: #d1ded6; font-size: 11px; }
.assistant-mode main { margin: auto; width: 100%; max-width: 1140px; padding: 28px 24px; }
.assistant-mode #session-info { font-size: 10px; }
.assistant-mode #collection-info { display: none; }
.assistant-mode .chat-panel { min-height: 520px; }
.assistant-mode #messages { min-height: 250px; }
.assistant-mode.signed-out main { min-height: calc(100vh - 74px); }
@media (max-width: 1000px) {
  .sidebar { width: 222px; padding: 25px 14px; }
  main { margin-left: 222px; width: calc(100% - 222px); padding: 26px 22px; }
  header { flex-wrap: wrap; }
  .header-right { width: 100%; grid-template-columns: minmax(130px, 1fr) 42px; }
  .header-right select { max-width: none; }
  .upload-choices { grid-template-columns: 1fr; }
  .panel { padding: 23px; }
  .hero h2 { font-size: 30px; }
}
@media (max-width: 700px) {
  body { display: block; }
  .sidebar { position: relative; inset: auto; width: 100%; padding: 16px 18px; display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; overflow: visible; }
  .brand { padding: 0; border: 0; margin-right: auto; }
  .brand-logo { width: 83px; }
  .brand small { font-size: 8px; }
  #nav-toggle { display: block; padding: 9px 13px; font-size: 12px; }
  .sidebar nav, .assistant-mode .sidebar nav { display: none; margin: 0; width: 100%; overflow: visible; }
  .nav-open .sidebar nav { display: block; order: 5; }
  .nav { width: 100%; white-space: normal; }
  .nav span { font-size: 13px; }
  .sidebar-label { display: block; }
  .local-note { display: none; }
  .logout { font-size: 10px; padding: 8px 0; }
  .mode-switch { margin: 0; padding: 9px 12px; font-size: 10px; }
  main, .assistant-mode main { margin: 0; width: 100%; padding: 24px 16px; }
  header { margin-bottom: 20px; }
  h1 { font-size: 28px; }
  #page-description { font-size: 12px; }
  .panel { padding: 19px; border-radius: 16px; }
  .hero { padding: 27px; }
  .stats { grid-template-columns: 1fr; gap: 9px; }
  .stats article { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 15px 20px; }
  .stats strong { grid-column: 2; grid-row: 1 / 3; margin: 0; }
  .stats small { grid-column: 1; }
  #login { padding: 24px; }
  .signed-out main { min-height: auto; padding-top: 35px; }
  .signed-out .sidebar { justify-content: flex-start; }
  .signed-out .brand { justify-content: flex-start; }
  .chat-toolbar { align-items: flex-start; }
  .chat-toolbar > div p { font-size: 11px; }
  .chat-panel { min-height: 520px; padding: 17px; }
  .chat-panel h2 { font-size: 15px; }
  .badge { font-size: 9px; }
  .chat-welcome { padding: 27px 0 15px; }
  .prompt-choices { flex-direction: column; }
  #messages { max-height: 58vh; }
  .message, .message.user { max-width: 100%; font-size: 13px; padding: 16px; }
  #chat-form { flex-wrap: wrap; }
  #question { width: 100%; flex-basis: 100%; }
  #send { margin-left: auto; }
  .assistant-mode .sidebar { padding: 14px 16px; gap: 12px; flex-wrap: wrap; }
  .assistant-mode .sidebar nav { position: static; box-shadow: none; padding: 8px 0; }
  .assistant-mode .mode-switch { order: 4; }
  .assistant-mode .logout { font-size: 10px; }
  .assistant-mode .brand small { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.chat-actions { display: flex; align-items: center; gap: 12px; }
.assistant-mode #session-info { margin-bottom: 16px; }
.assistant-mode .chat-panel { min-height: 0; }
.assistant-mode #messages { min-height: 225px; }
.assistant-mode .chat-welcome { padding: 10px 0 14px; max-width: 850px; }
.assistant-mode .chat-welcome .assistant-spark { width: 44px; height: 44px; font-size: 26px; border-radius: 14px; margin-bottom: 12px; }
.assistant-mode .chat-welcome p { margin-bottom: 15px; }
.assistant-mode .chat-welcome h3 { font-size: 23px; }
@media(max-width:700px) { .chat-actions .badge { display: none; } .assistant-mode .chat-welcome h3 { font-size: 20px; } }
#assistant-launcher { position: fixed; right: 24px; bottom: 22px; z-index: 45; border-radius: 28px; padding: 15px 23px; box-shadow: 0 8px 32px #003f3740; border: 1px solid #d6c58f; }
.assistant-dock { position: fixed; right: 24px; bottom: 85px; z-index: 44; width: min(450px, calc(100vw - 32px)); height: min(710px, calc(100dvh - 110px)); background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 65px #003f3738; display: flex; flex-direction: column; overflow: hidden; }
.dock-heading { display: flex; align-items: center; padding: 12px 16px; background: var(--green); color: white; gap: 8px; }
.dock-heading strong { margin-right: auto; font-size: 14px; }.dock-heading button { background: #ffffff18; color: white; padding: 7px 12px; }
#assistant-dock-body { overflow: auto; flex: 1; min-height: 0; }
.assistant-dock .chat-layout { gap: 0; height: 100%; }
.assistant-dock .chat-panel { border: 0; border-radius: 0; padding: 14px; min-height: 0; flex: 1; }
.assistant-dock .chat-panel > .section-head { display: none; }
.assistant-dock #messages { min-height: 120px; max-height: none; flex: 1; }
.assistant-dock .chat-welcome { padding: 12px 0; }.assistant-dock .chat-welcome h3 { font-size: 19px; }
.assistant-dock .prompt-choices { display: none; }
.assistant-dock .sources-panel { flex-shrink: 0; max-height: 180px; overflow: auto; border-radius: 0; padding: 12px 16px; }
.assistant-dock #chat-form { flex-wrap: wrap; }.assistant-dock #question { flex-basis: 100%; min-height: 60px; }
.assistant-dock #send { margin-left: auto; }
#cloud-choice { font-size: 12px; padding: 10px 0; color: #74501a; }#cloud-choice small { display: block; margin-top: 4px; }
#document-preview { width: min(900px, calc(100vw - 32px)); max-width: 900px; max-height: 85dvh; overflow: auto; }
#document-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; line-height: 1.7; font-size: 14px; }
#document-preview-content section { border-top: 1px solid var(--line); padding: 12px 0; }
#openai-settings label { display: block; }#openai-settings input:not([type=checkbox]) { display: block; width: 100%; margin-top: 8px; }
.document-quality { color: #896318; font-size: 11px; }
@media(max-width:700px) { #assistant-launcher { right: 16px; bottom: 16px; } .assistant-dock { right: 16px; bottom: 78px; } }

#doc-list td > small { display: block; margin-top: 6px; }
