:root {
  --bg: #ffffff;
  --sidebar: #f6f7f9;
  --sidebar-hover: #eceef2;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --line: #e6e8ec;
  --line-strong: #d9dce2;
  --blue: #3370ff;
  --blue-hover: #2860df;
  --blue-soft: #edf3ff;
  --violet-soft: #f2efff;
  --green-soft: #eaf8f2;
  --danger: #d54941;
  --shadow-composer: 0 8px 32px rgba(31, 35, 41, .10), 0 1px 4px rgba(31, 35, 41, .06);
  --shadow-card: 0 4px 18px rgba(31, 35, 41, .05);
  --body: "MiSans", "HarmonyOS Sans SC", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --utility: "Segoe UI Variable", "Microsoft YaHei UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}
button, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 9px 14px;
  color: white;
  background: var(--blue);
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100vh;
}

/* Sidebar */
.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px 14px 16px;
  background: var(--sidebar);
  border-right: 1px solid #f0f1f3;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 36px;
  padding: 0 7px;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -.02em;
}
.brand-mark {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  overflow: hidden;
  background: var(--blue);
  border-radius: 9px;
  box-shadow: 0 5px 12px rgba(51, 112, 255, .22);
}
.brand-mark i {
  position: absolute;
  left: 7px;
  width: 14px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transform-origin: left center;
}
.brand-mark i:nth-child(1) { top: 8px; transform: rotate(12deg); }
.brand-mark i:nth-child(2) { top: 13px; width: 11px; }
.brand-mark i:nth-child(3) { top: 18px; transform: rotate(-12deg); }

.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 22px 0 20px;
  padding: 11px 14px;
  color: #2458c6;
  background: #e8efff;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background .18s ease, transform .18s ease;
}
.new-chat span { font-size: 19px; font-weight: 400; line-height: 1; }
.new-chat:hover { background: #dfe9ff; }
.new-chat:active { transform: scale(.985); }

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
  color: var(--text-3);
  font-size: 11px;
}
.history-heading button {
  padding: 2px 0;
  color: var(--text-3);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 11px;
}
.history-heading button:hover { color: var(--text-2); }
.history-list {
  display: grid;
  gap: 3px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.history-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  border-radius: 8px;
  transition: background .15s ease;
}
.history-row:hover, .history-row:focus-within, .history-row.is-active { background: var(--sidebar-hover); }
.history-item {
  width: 100%;
  padding: 10px 11px;
  overflow: hidden;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
}
.history-item:hover, .history-item.is-active { background: transparent; }
.history-item.is-active { color: #2458c6; }
.delete-history-item {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  color: #9aa0a8;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: color .15s ease, background .15s ease, opacity .15s ease;
}
.history-row:hover .delete-history-item,
.history-row:focus-within .delete-history-item,
.delete-history-item:focus-visible { opacity: 1; }
.delete-history-item:hover { color: #c13e37; background: #fdeceb; }
.delete-history-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.delete-history-item span { font-size: 18px; line-height: 1; transform: translateY(-1px); }
.history-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 540;
}
.history-item span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}
.history-empty {
  margin: 34px 8px 0;
  color: var(--text-3);
  text-align: center;
}
.history-empty > span { display: block; font-size: 26px; opacity: .45; }
.history-empty p { margin: 10px 0 4px; color: var(--text-2); font-size: 12px; }
.history-empty small { font-size: 10px; }
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding: 13px 8px 0;
  color: var(--text-3);
  border-top: 1px solid var(--line);
  font-size: 11px;
  white-space: nowrap;
  flex-wrap: nowrap;
  overflow: hidden;
}
.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: #37b27e;
  border: 2px solid #d9f4e8;
  border-radius: 50%;
  box-sizing: content-box;
}
.sidebar-backdrop { display: none; }

/* Main conversation */
.chat-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
.chat-header {
  position: relative;
  z-index: 10;
  display: flex;
  flex: 0 0 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.header-title { display: flex; align-items: center; gap: 12px; }
.header-title > div { display: grid; gap: 2px; }
.header-title strong { font-size: 14px; font-weight: 650; }
.header-title span { color: var(--text-3); font-size: 10px; }
.library-state {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 11px;
}
.library-state b { color: var(--text-2); font-weight: 650; }
.library-state i { width: 1px; height: 12px; background: var(--line); }
.library-doc-trigger {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}
.library-doc-trigger:hover span,
.library-doc-trigger:focus-visible span { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.library-doc-trigger:focus-visible { outline: 2px solid rgba(23, 133, 139, .35); outline-offset: 2px; border-radius: 4px; }
.library-doc-trigger:disabled { cursor: default; opacity: .55; }
.icon-button { padding: 0; background: transparent; border: 0; cursor: pointer; }
.mobile-menu { display: none; width: 28px; height: 28px; }
.mobile-menu span { display: block; width: 17px; height: 1.5px; margin: 4px auto; background: var(--text); }

.conversation-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.conversation-inner {
  width: min(860px, calc(100% - 48px));
  min-height: 100%;
  margin: 0 auto;
  padding: 48px 0 220px;
}

/* Welcome */
.welcome-state {
  display: flex;
  min-height: calc(100vh - 64px - 268px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.welcome-symbol {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 20px;
  background: linear-gradient(145deg, #eef4ff, #f8faff);
  border: 1px solid #dfe8ff;
  border-radius: 19px;
  box-shadow: 0 14px 32px rgba(51, 112, 255, .12);
}
.welcome-symbol span {
  position: absolute;
  width: 28px;
  height: 7px;
  background: var(--blue);
  border-radius: 7px 2px 7px 2px;
  transform-origin: center;
}
.welcome-symbol span:nth-child(1) { transform: translateY(-8px) rotate(6deg); opacity: .45; }
.welcome-symbol span:nth-child(2) { transform: rotate(-3deg); opacity: .72; }
.welcome-symbol span:nth-child(3) { transform: translateY(8px) rotate(4deg); }
.welcome-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-family: var(--utility);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
}
.welcome-state h1 {
  margin: 0;
  font-size: clamp(27px, 3vw, 36px);
  font-weight: 680;
  letter-spacing: -.045em;
}
.welcome-copy {
  max-width: 570px;
  margin: 12px auto 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.8;
}
.starter-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  width: min(560px, 100%);
  margin-top: 38px;
  text-align: left;
}
.starter-panels {
  width: 100%;
  margin-top: 0;
}
.starter-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
}
.starter-prompt {
  position: relative;
  width: 100%;
  min-height: 42px;
  padding: 10px 42px 10px 14px;
  color: var(--text-1);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.55;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.starter-prompt:disabled {
  cursor: wait;
  opacity: .65;
}
.starter-prompt::after {
  content: "→";
  position: absolute;
  right: 14px;
  top: 50%;
  color: var(--blue);
  font-size: 14px;
  opacity: 0;
  transform: translate(-5px, -50%);
  transition: opacity .18s, transform .18s;
}
.starter-prompt:hover {
  transform: translateX(3px);
  border-color: #c7d6f5;
  background: #fbfdff;
  box-shadow: 0 5px 16px rgba(43, 91, 180, .08);
}
.starter-prompt:hover::after { opacity: 1; transform: translate(0, -50%); }
.starter-empty {
  width: 100%;
  margin: 12px 0 0;
  padding: 12px 14px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
  background: #f8f9fb;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.starter-review {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.starter-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-2);
  font-size: 12px;
}
.starter-review-head span {
  color: var(--text-3);
  font-size: 11px;
}
.starter-review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
}
.starter-review-item {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.starter-review-item p {
  margin: 0 0 8px;
  color: var(--text-1);
  font-size: 12px;
  line-height: 1.55;
}
.starter-review-item small {
  display: block;
  margin-bottom: 8px;
  color: var(--text-3);
  font-size: 10px;
}
.starter-review-actions {
  display: flex;
  gap: 8px;
}
.starter-review-actions button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 8px;
  cursor: pointer;
}
.starter-review-actions .approve-btn {
  color: #fff;
  background: #2f855a;
  border: 0;
}
.starter-review-actions .reject-btn {
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--line);
}

/* Messages */
.result-state { padding-top: 4px; }
.message-row { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 34px; }
.user-row { justify-content: flex-end; }
.user-message {
  max-width: min(680px, calc(100% - 54px));
  padding: 13px 17px;
  color: #1d315e;
  background: #edf3ff;
  border-radius: 16px 4px 16px 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.user-avatar, .assistant-avatar {
  display: grid;
  flex: 0 0 32px;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
}
.user-avatar { color: white; background: #272b34; font-size: 11px; font-weight: 650; }
.assistant-avatar {
  position: relative;
  overflow: hidden;
  background: var(--blue);
  box-shadow: 0 4px 11px rgba(51, 112, 255, .16);
}
.assistant-avatar i {
  position: absolute;
  width: 16px;
  height: 3px;
  background: white;
  border-radius: 3px 1px 3px 1px;
}
.assistant-avatar i:nth-child(1) { transform: translateY(-5px) rotate(8deg); opacity: .55; }
.assistant-avatar i:nth-child(2) { opacity: .8; }
.assistant-avatar i:nth-child(3) { transform: translateY(5px) rotate(-8deg); }
.assistant-avatar.is-error { color: white; background: var(--danger); font-weight: 700; }
.message-body { min-width: 0; flex: 1; }
.assistant-message { padding-top: 2px; }
.answer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin-bottom: 12px;
}
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: #2458c6;
  background: var(--blue-soft);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 650;
}
.mode-badge::before { content: ""; width: 5px; height: 5px; background: var(--blue); border-radius: 50%; }
.mode-badge[data-mode="solution_guidance"] { color: #7551bf; background: var(--violet-soft); }
.mode-badge[data-mode="solution_guidance"]::before { background: #8664ce; }
.mode-badge[data-mode="model_only"] { color: #687079; background: #f0f1f3; }
.mode-badge[data-mode="model_only"]::before { background: #8f959e; }
.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 10px;
}
.copy-button:hover { color: var(--text-2); background: var(--surface-soft); }
.answer-content { color: #2b2f36; font-size: 14px; line-height: 1.88; }

.streaming-cursor {
  display: inline;
  animation: cursor-blink 0.8s infinite;
  color: var(--accent, #2563eb);
  font-weight: 700;
}
@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.answer-content h2, .answer-content h3, .answer-content h4 {
  margin: 28px 0 10px;
  color: var(--text);
  line-height: 1.45;
}
.answer-content h2 { font-size: 18px; }
.answer-content h3 { position: relative; padding-left: 12px; font-size: 16px; }
.answer-content h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: .32em;
  width: 3px;
  height: 1em;
  background: var(--blue);
  border-radius: 3px;
}
.answer-content h4 { font-size: 15px; }
.answer-content p { margin: 8px 0; }
.answer-content ul { margin: 8px 0 14px; padding-left: 21px; }
.answer-content li { margin: 5px 0; padding-left: 2px; }
.answer-content table {
  display: block;
  width: 100%;
  margin: 16px 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 12px;
}
.answer-content th, .answer-content td { min-width: 110px; padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.answer-content th { background: var(--surface-soft); font-weight: 650; }
.citation-link {
  margin: 0 2px;
  padding: 1px 5px;
  color: #285fd4;
  background: var(--blue-soft);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: .88em;
  font-weight: 650;
}
.citation-link:hover { background: #dfe9ff; }

.loading-state { margin-top: 16px; }
.loading-state .message-body { padding-top: 2px; }
.loading-state p { margin: 12px 0 5px; color: var(--text-2); font-size: 13px; }
.loading-state small { color: var(--text-3); font-size: 10px; letter-spacing: .04em; }
.thinking-line { display: flex; align-items: center; gap: 5px; height: 10px; }
.thinking-line span { width: 6px; height: 6px; background: #8cafff; border-radius: 50%; animation: thinking 1.2s infinite ease-in-out; }
.thinking-line span:nth-child(2) { animation-delay: .16s; }
.thinking-line span:nth-child(3) { animation-delay: .32s; }
@keyframes thinking { 0%, 70%, 100% { transform: translateY(0); opacity: .4; } 35% { transform: translateY(-4px); opacity: 1; } }

.error-message { padding: 2px 0; }
.error-message strong { font-size: 14px; }
.error-message p { margin: 8px 0 14px; color: var(--text-2); font-size: 12px; }
.error-message button { padding: 7px 12px; color: var(--danger); background: white; border: 1px solid #efc9c6; border-radius: 7px; cursor: pointer; font-size: 11px; }

/* Evidence rail */
.evidence-section {
  margin: 12px 0 20px 46px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}
.evidence-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.evidence-heading > div { display: flex; align-items: center; gap: 11px; }
.evidence-line { position: relative; width: 22px; height: 22px; border: 1px solid #cdd9f3; border-radius: 50%; }
.evidence-line::before, .evidence-line::after { content: ""; position: absolute; left: 5px; width: 10px; height: 1px; background: var(--blue); }
.evidence-line::before { top: 8px; }
.evidence-line::after { top: 12px; width: 7px; }
.evidence-heading h2 { margin: 0; font-size: 13px; font-weight: 650; }
.evidence-heading p { margin: 3px 0 0; color: var(--text-3); font-size: 9px; }
.source-count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: #285fd4;
  background: var(--blue-soft);
  border-radius: 11px;
  font-size: 10px;
  font-weight: 700;
}
.source-list { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.source-card {
  position: relative;
  min-width: 0;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.source-card:hover { border-color: #ccd7ed; box-shadow: var(--shadow-card); }
.source-card.is-highlighted { transform: translateY(-2px); border-color: #7da3f9; box-shadow: 0 0 0 3px rgba(51, 112, 255, .10); }
.source-ref { display: inline-flex; padding: 3px 6px; color: #285fd4; background: var(--blue-soft); border-radius: 5px; font-size: 9px; font-weight: 700; }
.source-card h3 { min-height: 38px; margin: 8px 0 10px; overflow: hidden; font-size: 11px; font-weight: 620; line-height: 1.65; }
.source-card dl { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 7px; margin: 0; font-size: 9px; line-height: 1.5; }
.source-card dt { color: var(--text-3); }
.source-card dd { margin: 0; overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.score-track { height: 3px; margin-top: 11px; overflow: hidden; background: #e0e3e8; border-radius: 3px; }
.score-track i { display: block; height: 100%; background: linear-gradient(90deg, #70a0ff, var(--blue)); border-radius: inherit; }
.source-card details { margin-top: 9px; color: var(--text-2); font-size: 9px; }
.source-card summary { cursor: pointer; color: #526070; }
.source-card details p { max-height: 130px; margin: 8px 0 0; overflow-y: auto; line-height: 1.7; }
.source-empty { padding: 20px; color: var(--text-3); background: var(--surface-soft); border-radius: 10px; text-align: center; font-size: 10px; }

/* Composer */
.composer-dock {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 34px 24px 14px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 26%, #fff 100%);
  pointer-events: none;
}
.composer-inner { width: min(860px, 100%); margin: 0 auto; pointer-events: auto; }
.context-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 7px 10px;
  color: #45649f;
  background: #f2f6ff;
  border: 1px solid #e1e9fb;
  border-radius: 8px;
  font-size: 10px;
}
.context-bar > span { font-size: 14px; }
.context-bar p { flex: 1; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-bar button { padding: 2px 4px; color: #45649f; background: transparent; border: 0; cursor: pointer; font-size: 10px; }
.composer-starters {
  margin: 0 12px 8px;
}
.composer-starters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  color: #45649f;
  background: #f7f9fc;
  border: 1px solid #e6ebf3;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.3;
  transition: background .15s, border-color .15s, color .15s;
}
.composer-starters-toggle:hover {
  color: #2f5fbf;
  background: #eef3ff;
  border-color: #d5e1fb;
}
.composer-starters-toggle em {
  font-style: normal;
  font-size: 10px;
  opacity: .75;
  transition: transform .15s;
}
.composer-starters.is-open .composer-starters-toggle em {
  transform: rotate(180deg);
}
.composer-starters-panel {
  display: grid;
  gap: 6px;
  max-height: min(38vh, 260px);
  margin-top: 8px;
  padding: 8px;
  overflow: auto;
  background: rgba(255, 255, 255, .96);
  border: 1px solid #e6ebf3;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(31, 35, 41, .08);
}
.composer-starters-panel .starter-prompt {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 12px;
  text-align: left;
}
.composer {

  padding: 10px 11px 9px 16px;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-composer);
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within { border-color: #98b5f8; box-shadow: 0 0 0 3px rgba(51,112,255,.08), var(--shadow-composer); }
#question {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 150px;
  padding: 7px 2px 5px;
  resize: none;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
  line-height: 1.65;
}
#question::placeholder { color: #a2a7af; }
.composer-tools { display: flex; align-items: center; justify-content: space-between; min-height: 34px; }
.source-setting {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 11px;
}
.source-setting > span { color: #5c85e5; font-size: 13px; }
#topK { padding: 2px 18px 2px 3px; color: var(--text-2); background: transparent; border: 0; outline: 0; cursor: pointer; font-size: 11px; }
.send-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: white;
  background: var(--blue);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  transition: background .16s, transform .16s;
}
.send-button:hover { background: var(--blue-hover); transform: translateY(-1px); }
.send-button.is-stop { background: #4f5965; }
.send-button.is-stop:hover { background: #3f4853; }
.send-button:disabled { background: #b7c8ed; cursor: wait; transform: none; }
.send-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.send-button .stop-icon { display: none; stroke: none; fill: currentColor; }
.send-button.is-stop .send-icon { display: none; }
.send-button.is-stop .stop-icon { display: block; }
.mode-badge[data-mode="interrupted"] { color: #9a5b17; background: #fff5e8; }
.mode-badge[data-mode="interrupted"]::before { background: #d48806; }
.composer-note { margin: 8px 0 0; color: #a1a6ae; text-align: center; font-size: 9px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
button:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(51,112,255,.22); outline-offset: 2px; }

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    box-shadow: 20px 0 55px rgba(31,35,41,.14);
    transition: transform .22s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    visibility: hidden;
    padding: 0;
    background: rgba(27,31,38,.28);
    border: 0;
    opacity: 0;
    transition: opacity .22s, visibility .22s;
  }
  body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
  .mobile-menu { display: block; }
  .conversation-inner { width: min(820px, calc(100% - 32px)); }
}

@media (max-width: 640px) {
  .chat-header { flex-basis: 58px; padding: 0 14px; }
  .library-state span { font-size: 9px; }
  .library-state i, .library-state span:last-child { display: none; }
  .conversation-inner { width: calc(100% - 28px); padding-top: 26px; padding-bottom: 205px; }
  .welcome-state { min-height: calc(100vh - 58px - 235px); }
  .welcome-state h1 { font-size: 26px; }
  .welcome-copy { font-size: 12px; }
  .starter-list { gap: 7px; margin-top: 25px; }
  .starter-prompt { min-height: 40px; font-size: 12px; }
  .message-row { gap: 9px; margin-bottom: 26px; }
  .user-avatar, .assistant-avatar { flex-basis: 28px; width: 28px; height: 28px; border-radius: 9px; }
  .user-message { max-width: calc(100% - 38px); padding: 11px 14px; font-size: 13px; }
  .answer-content { font-size: 13px; line-height: 1.82; }
  .evidence-section { margin-left: 37px; }
  .source-list { grid-template-columns: 1fr; }
  .composer-dock { padding: 30px 10px 9px; }
  .composer { border-radius: 16px; }
  .composer-note { font-size: 8px; }
  .context-bar { margin-right: 6px; margin-left: 6px; }
  .composer-starters { margin-right: 6px; margin-left: 6px; }
  .composer-starters-panel { max-height: min(32vh, 220px); }
}

/* ---------- Auth wall ---------- */
.auth-wall {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.auth-card {
  width: 380px;
  padding: 44px 36px 36px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  text-align: center;
}
.auth-brand {
  display: inline-flex;
  gap: 5px;
  margin-bottom: 16px;
}
.auth-brand span {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--blue);
  border-radius: 50%;
  opacity: 0.75;
}
.auth-brand span:nth-child(2) { opacity: 0.55; }
.auth-brand span:nth-child(3) { opacity: 0.35; }
.auth-card h1 {
  font-size: 28px;
  color: var(--blue);
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.auth-card > p {
  color: var(--text-3);
  font-size: 13px;
  margin: 0 0 28px;
}
.auth-card input {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.auth-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(51,112,255,.08);
}
.auth-card button {
  width: 100%;
  padding: 11px;
  margin-top: 10px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-card button:hover { background: var(--blue-hover, #2559d4); }
.login-error {
  color: var(--danger, #d93025);
  font-size: 12px;
  margin: 0 0 -4px;
  text-align: left;
}

/* ---------- Sidebar auth ---------- */
.sidebar-footer-divider {
  display: inline-block;
  width: 1px;
  height: 14px;
  flex: 0 0 auto;
  background: var(--line);
  margin: 0 4px;
}
.current-user {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logout-button {
  padding: 2px 8px;
  color: var(--text-3);
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  margin-left: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.logout-button:hover {
  color: var(--danger, #d93025);
  border-color: #efc9c6;
}

/* ---------- Source file link ---------- */
.source-file-link {
  color: var(--blue);
  text-decoration: none;
  word-break: break-all;
}
.source-file-link:hover {
  text-decoration: underline;
}
.source-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.source-open-btn:hover {
  background: var(--blue);
  color: #fff;
}

/* ---------- Admin knowledge intake ---------- */
.header-actions { display: flex; align-items: center; gap: 14px; }
.admin-entry {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px;
  color: #234d68; background: #eef6f7; border: 1px solid #cfe2e4;
  border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 700;
}
.admin-entry:hover { background: #e2f0f1; border-color: #a8ced2; }
.admin-entry span { font-size: 16px; line-height: 1; }
.price-entry { color: #6b4b10; background: #fff8e8; border-color: #ead7aa; }
.price-entry:hover { background: #fff2d3; border-color: #d8ba72; }
.admin-panel { position: fixed; inset: 0; z-index: 120; }
.admin-panel-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(18, 29, 39, .55); backdrop-filter: blur(3px); }
.admin-sheet {
  position: absolute; inset: 18px; display: flex; flex-direction: column; overflow: hidden;
  max-width: 1440px; margin: auto; background: #f5f7f8; border: 1px solid rgba(255,255,255,.45);
  border-radius: 14px; box-shadow: 0 28px 90px rgba(10, 24, 34, .28);
}
.admin-sheet-header {
  display: flex; align-items: flex-start; justify-content: space-between; padding: 25px 30px 22px;
  color: #f6fbfc; background: #15384b;
}
.admin-sheet-header p { margin: 0 0 7px; color: #84c7cb; font: 700 10px/1 var(--utility); letter-spacing: .18em; }
.admin-sheet-header h1 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.admin-sheet-header span { display: block; margin-top: 7px; color: #b8cbd4; font-size: 12px; }
.admin-close { width: 36px; height: 36px; color: #d9e6ea; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 50%; cursor: pointer; font-size: 24px; line-height: 1; }
.intake-rail { display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-bottom: 1px solid var(--line); }
.intake-rail span { position: relative; padding: 13px 18px; color: #77838b; border-right: 1px solid var(--line); font-size: 11px; }
.intake-rail span:last-child { border-right: 0; }
.intake-rail b { margin-right: 7px; color: #a4adb3; font: 700 10px/1 var(--utility); }
.intake-rail span.is-active { color: #15384b; background: #edf6f6; font-weight: 700; }
.intake-rail span.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: #17858b; }
.intake-rail span.is-done { color: #17858b; }
.intake-rail span.is-done b { color: #17858b; }
.admin-sheet-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; min-height: 0; padding: 18px; overflow: auto; }
.intake-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start; }
.intake-block, .retest-panel { padding: 19px; background: #fff; border: 1px solid #e0e5e8; border-radius: 10px; box-shadow: 0 2px 10px rgba(26, 49, 62, .035); }
.upload-block, .metadata-block { grid-column: 1 / -1; }
.block-heading { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 15px; }
.block-heading > span { display: grid; place-items: center; flex: 0 0 29px; height: 29px; color: #fff; background: #17858b; border-radius: 7px; font: 750 10px/1 var(--utility); }
.block-heading h2 { margin: 1px 0 3px; color: #183746; font-size: 15px; }
.block-heading p { margin: 0; color: #7a858c; font-size: 11px; line-height: 1.5; }
.file-drop { display: grid; place-items: center; min-height: 112px; padding: 18px; border: 1.5px dashed #a9c6ca; border-radius: 9px; background: #f5fbfb; cursor: pointer; text-align: center; }
.file-drop:hover { border-color: #17858b; background: #eff9f9; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop strong { color: #245b61; font-size: 14px; }
.file-drop span { margin-top: 5px; color: #8a969c; font-size: 10px; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metadata-field-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.metadata-field-grid label { min-width: 0; }
.metadata-field-grid input,
.metadata-field-grid select {
  padding: 8px 8px;
  font-size: 11px;
}
.metadata-field-grid .field-label { font-size: 9px; }
.field-grid label, .retest-panel label { display: grid; gap: 6px; color: #53636c; font-size: 10px; font-weight: 700; }
.field-label { display: inline-flex; align-items: center; gap: 2px; color: #53636c; font-size: 10px; font-weight: 700; }
.required-mark { color: #e03131; margin-left: 1px; font-weight: 800; font-size: 12px; line-height: 1; }
.field-grid .wide { grid-column: span 2; }
.field-grid input, .field-grid select, .retest-panel textarea {
  width: 100%; padding: 9px 10px; color: #263b46; background: #fbfcfc;
  border: 1px solid #dce2e5; border-radius: 6px; outline: none; font-size: 12px;
}
.field-grid input:focus, .field-grid select:focus, .retest-panel textarea:focus { border-color: #17858b; box-shadow: 0 0 0 3px rgba(23,133,139,.09); }
.action-button { margin-top: 13px; padding: 9px 14px; border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 750; }
.action-button:disabled { cursor: not-allowed; opacity: .42; }
.action-button.primary { color: white; background: #17858b; border: 1px solid #17858b; }
.action-button.secondary { color: #225e65; background: #f2f9f9; border: 1px solid #b9d7da; }
.action-button.commit { color: white; background: #d17a20; border: 1px solid #d17a20; }
.stage-receipt, .upload-preview, .upload-caliber-echo, .run-result, .retest-result { margin-top: 12px; padding: 11px 12px; color: #53636c; background: #f7f9fa; border-left: 3px solid #8eaeb2; border-radius: 4px; font-size: 11px; line-height: 1.55; }
.upload-caliber-echo strong { display: block; margin-bottom: 6px; color: #244857; font-size: 11px; }
.stage-receipt span { display: block; color: #8b969c; font: 700 9px/1 var(--utility); letter-spacing: .12em; }
.stage-receipt code { display: block; margin: 5px 0; overflow-wrap: anywhere; color: #173d4d; font: 10px/1.45 Consolas, monospace; }
.run-result.is-success { border-color: #2b9a6e; background: #f1faf6; }
.run-result.is-error { border-color: #d54941; background: #fff5f4; }
.retest-panel { position: sticky; top: 0; align-self: start; min-height: 420px; }
.retest-panel textarea { resize: vertical; min-height: 92px; margin-top: 5px; }
.retest-result ol { margin: 7px 0 0; padding-left: 18px; }
.retest-result li { margin-bottom: 8px; }
.retest-result strong { display: block; color: #244857; }
.retest-result small { color: #7d898f; }
.admin-upload-error { margin-top: 14px; padding: 11px; color: #9c342f; background: #fff2f1; border: 1px solid #f1cfcc; border-radius: 6px; font-size: 11px; white-space: pre-wrap; }
.stage-upload-error { margin-top: 10px; }

/* ---------- Document list modal ---------- */
.doc-list-modal { position: fixed; inset: 0; z-index: 110; }
.doc-list-sheet {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(720px, calc(100% - 32px)); max-height: min(78vh, 720px);
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #fff; border: 1px solid #e0e5e8; border-radius: 12px;
  box-shadow: 0 18px 48px rgba(18, 29, 39, .18); overflow: hidden;
}
.doc-list-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; background: #1e3442; color: #fff;
}
.doc-list-header p { margin: 0 0 6px; color: #84c7cb; font: 700 10px/1 var(--utility); letter-spacing: .16em; }
.doc-list-header h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.doc-list-header span { display: block; margin-top: 6px; color: #b8cbd4; font-size: 12px; }
.doc-list-toolbar {
  padding: 12px 20px 0;
  background: #fff;
  border-bottom: 1px solid #eef2f4;
}
.doc-list-search { display: block; margin-bottom: 12px; }
.doc-list-search input {
  width: 100%; padding: 9px 11px; color: #263b46; background: #fbfcfc;
  border: 1px solid #dce2e5; border-radius: 7px; outline: none; font-size: 12px;
}
.doc-list-search input:focus { border-color: #17858b; box-shadow: 0 0 0 3px rgba(23,133,139,.09); }
.doc-list-search input::-webkit-search-cancel-button { cursor: pointer; }
.doc-list-items {
  margin: 0; padding: 10px 0; overflow: auto; list-style: none;
}
.doc-list-items li {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 20px; color: #294653; border-bottom: 1px solid #eef2f4; font-size: 12px; line-height: 1.45;
}
.doc-list-items li:last-child { border-bottom: 0; }
.doc-list-items li > span:first-child {
  display: grid; place-items: center; width: 24px; height: 24px;
  color: #17858b; background: #edf6f6; border-radius: 6px; font: 700 10px/1 var(--utility);
}
.doc-list-main { min-width: 0; }
.doc-list-items li strong { display: block; font-weight: 650; overflow-wrap: anywhere; }
.doc-list-meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px;
  color: #7a858c; font-size: 10px; line-height: 1.4;
}
.doc-list-meta i { color: #c5ced1; font-style: normal; }
.doc-list-meta b { color: #53636c; font-weight: 650; }
.doc-list-edit {
  margin-top: 0; padding: 7px 12px; color: #225e65; background: #edf7f7;
  border: 1px solid #bfd9db; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 650; white-space: nowrap;
}
.doc-list-edit:hover { background: #e4f3f3; }
.doc-list-items .doc-list-empty,
.doc-list-items .doc-list-loading { grid-template-columns: 1fr; color: #7a858c; }

.doc-caliber-modal { position: fixed; inset: 0; z-index: 120; }
.doc-caliber-sheet {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(760px, calc(100% - 32px));
  background: #fff; border: 1px solid #e0e5e8; border-radius: 12px;
  box-shadow: 0 18px 48px rgba(18, 29, 39, .18); overflow: hidden;
}
.doc-caliber-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; background: #1e3442; color: #fff;
}
.doc-caliber-header p { margin: 0 0 6px; color: #84c7cb; font: 700 10px/1 var(--utility); letter-spacing: .16em; }
.doc-caliber-header h2 { margin: 0; font-size: 18px; }
.doc-caliber-header span { display: block; margin-top: 6px; color: #b8cbd4; font-size: 12px; overflow-wrap: anywhere; }
.doc-caliber-form { padding: 16px 20px 18px; }
.field-grid.doc-caliber-grid,
.doc-caliber-form .doc-caliber-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}
.doc-caliber-grid label { min-width: 0; }
.doc-caliber-grid input,
.doc-caliber-grid select {
  padding: 9px 10px;
  font-size: 12px;
}
.doc-caliber-grid .field-label { font-size: 10px; }
.doc-caliber-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.doc-caliber-actions .action-button { margin-top: 0; }
.doc-list-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 20px 14px; background: #f7f9fa; border-top: 1px solid #eef2f4;
}
.doc-list-page-btn {
  min-width: 72px; padding: 7px 10px; color: #225e65; background: #edf7f7;
  border: 1px solid #bfd9db; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 650;
}
.doc-list-page-btn:disabled { cursor: not-allowed; opacity: .45; }
.doc-list-page-btn:not(:disabled):hover { background: #e4f3f3; }
#documentListPageInfo { color: #64747b; font-size: 11px; white-space: nowrap; }

/* ---------- Controlled price center ---------- */
.price-sheet { max-width: 1280px; }
.price-sheet-header { background: #1e3442; }
.price-sheet-header p { color: #e7bd62; }
.price-workspace { min-height: 0; padding: 20px; overflow: auto; }
.price-search-zone, .price-admin-zone { position: relative; padding: 20px; background: #fff; border: 1px solid #e0e5e8; border-radius: 11px; }
.price-admin-zone { margin-top: 16px; background: #f2f5f6; }
.price-time-mark { display: flex; align-items: baseline; gap: 10px; margin-bottom: 13px; }
.price-time-mark b { color: #1e3442; font-size: 17px; }
.price-time-mark span { color: #a06f12; font: 700 11px/1 var(--utility); }
.price-search-form { display: grid; grid-template-columns: 1.5fr 1fr .7fr .8fr auto; gap: 10px; align-items: end; }
.price-search-form label { display: grid; gap: 6px; color: #596970; font-size: 10px; font-weight: 700; }
.price-search-form input, .compact-admin-form input, .compact-admin-form select {
  width: 100%; min-width: 0; padding: 9px 10px; color: #263b46; background: #fbfcfc;
  border: 1px solid #dce2e5; border-radius: 6px; outline: none; font: 12px var(--body);
}
.price-search-form input:focus, .compact-admin-form input:focus, .compact-admin-form select:focus { border-color: #17858b; box-shadow: 0 0 0 3px rgba(23,133,139,.09); }
.price-search-form .action-button { height: 36px; margin: 0; }
.price-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; margin-top: 16px; }
.price-empty { grid-column: 1 / -1; padding: 24px; color: #7a858c; background: #f7f9fa; border: 1px dashed #cfd8dc; border-radius: 8px; font-size: 12px; text-align: center; }
.price-card { position: relative; min-width: 0; padding: 16px; overflow: hidden; background: #fff; border: 1px solid #dfe5e7; border-radius: 9px; box-shadow: 0 3px 12px rgba(30,52,66,.04); }
.price-card::before { content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 3px; background: #d39b2c; }
.price-card-code { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price-card-code span { color: #244857; font: 750 11px/1 var(--utility); letter-spacing: .03em; }
.price-card-code small { color: #8a969c; font-size: 9px; }
.price-amount { display: flex; align-items: baseline; gap: 7px; margin: 16px 0 4px; color: #182f3c; }
.price-amount b { font: 720 30px/1 var(--utility); letter-spacing: -.03em; }
.price-amount span { color: #9a6e18; font: 750 11px/1 var(--utility); }
.price-card h3 { margin: 8px 0 14px; font-size: 13px; font-weight: 650; }
.price-timeline { position: relative; display: flex; justify-content: space-between; gap: 12px; padding-top: 11px; color: #64747b; border-top: 1px solid #e8ecee; font-size: 10px; }
.price-timeline i { position: absolute; top: -3px; left: 0; width: 6px; height: 6px; background: #d39b2c; border-radius: 50%; }
.price-card footer { margin-top: 10px; color: #89949a; font-size: 9px; line-height: 1.5; }
.price-admin-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.compact-admin-form { box-shadow: none; }
.price-field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.user-avatar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: 2px;
  padding: 0;
  color: #f4fbfc;
  background: linear-gradient(145deg, #1b6f78, #154b5c);
  border: 1px solid #0f3d49;
  border-radius: 50%;
  cursor: pointer;
  font: 700 13px/1 var(--utility);
  box-shadow: 0 2px 8px rgba(21, 75, 92, .22);
}
.user-avatar-button:hover { filter: brightness(1.06); }
.user-auth-sheet {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 32px));
  max-width: 640px;
  max-height: min(78vh, 720px);
  height: auto;
}
.user-auth-header { background: #163947; padding: 18px 20px; }
.user-auth-header p { color: #7ec7cf; }
.user-auth-header h1 { font-size: 20px; }
.user-auth-workspace {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 14px 16px 16px;
  overflow: auto;
}
.user-auth-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e0e5e8;
  border-radius: 11px;
}
.user-auth-profile .block-heading { margin: 0; }
.user-auth-profile .action-button { margin: 0; width: auto; min-width: 108px; }
#userPermissionTools {
  padding: 18px;
  background: #fff;
  border: 1px solid #e0e5e8;
  border-radius: 11px;
}
.user-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  align-items: center;
}
.user-create-form > input {
  width: 100%;
  min-width: 0;
}
.user-create-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 12px;
}
.user-create-form label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #53636c;
  font-size: 10px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.user-create-form label input { width: auto; margin: 0; }
.user-create-form .user-create-submit {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  margin: 0 0 0 auto;
  padding: 6px 12px;
  font-size: 11px;
  white-space: nowrap;
}
.user-permission-list { display: grid; gap: 6px; margin-top: 14px; }
.permission-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 9px;
  background: #f7f9fa;
  border: 1px solid #e4e8ea;
  border-radius: 7px;
}
.permission-row > div:first-child {
  flex: 0 0 auto;
  min-width: 52px;
  max-width: 96px;
  margin-right: 2px;
}
.permission-row strong, .permission-row small { display: block; line-height: 1.25; }
.permission-row strong { color: #294653; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.permission-row small { color: #929ca1; font-size: 9px; }
.permission-row label { display: flex; align-items: center; gap: 3px; color: #68777e; font-size: 9px; white-space: nowrap; flex: 0 0 auto; }
.permission-row label input { width: auto; margin: 0; }
.permission-row > label:first-of-type { margin-left: auto; }
.permission-row .permission-save-btn {
  flex: 0 0 auto;
  margin-left: 2px;
  padding: 5px 7px;
  color: #225e65;
  background: #edf7f7;
  border: 1px solid #bfd9db;
  border-radius: 5px;
  cursor: pointer;
  font-size: 9px;
  white-space: nowrap;
}
.permission-row .permission-delete-btn {
  flex: 0 0 auto;
  margin-left: 0;
  padding: 5px 7px;
  color: #8a3b3b;
  background: #fbf1f1;
  border: 1px solid #e2c0c0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 9px;
  white-space: nowrap;
}
.permission-row button:disabled { opacity: .45; cursor: default; }

@media (max-width: 980px) {
  .admin-sheet { inset: 8px; }
  .admin-sheet-body { grid-template-columns: 1fr; }
  .retest-panel { position: static; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metadata-field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-grid.doc-caliber-grid,
  .doc-caliber-form .doc-caliber-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-search-form .action-button { height: auto; }
  .price-admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .delete-history-item { opacity: 1; }
  .admin-entry { padding: 7px; }
  .admin-entry span + * { display: none; }
  .intake-rail { grid-template-columns: repeat(5, minmax(52px, 1fr)); }
  .intake-rail span { padding: 10px 4px; text-align: center; font-size: 0; }
  .intake-rail b { margin: 0; font-size: 10px; }
  .admin-sheet-header { padding: 19px; }
  .admin-sheet-body { padding: 10px; }
  .intake-form { grid-template-columns: 1fr; }
  .run-block, .commit-block { grid-column: 1; }
  .field-grid { grid-template-columns: 1fr; }
  .metadata-field-grid { grid-template-columns: 1fr; }
  .field-grid.doc-caliber-grid,
  .doc-caliber-form .doc-caliber-grid { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: 1; }
  .price-workspace { padding: 10px; }
  .price-search-form, .price-field-grid, .user-create-form { grid-template-columns: 1fr; }
  .user-create-actions { flex-wrap: wrap; }
  .user-create-form .user-create-submit { margin-left: 0; }
  .permission-row { flex-wrap: wrap; }
  .permission-row > label:first-of-type { margin-left: 0; }
  .permission-row .permission-save-btn { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
