:root {
  --bg: #050810;
  --panel: #0d1424;
  --panel-2: #111b2f;
  --line: rgba(120, 205, 255, 0.2);
  --text: #eef7ff;
  --muted: #93a8bf;
  --cyan: #34d7ff;
  --blue: #3478ff;
  --green: #35f2a0;
  --amber: #ffc85a;
  --red: #ff647c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 70% -10%, rgba(52, 215, 255, 0.2), transparent 32%),
    radial-gradient(circle at 10% 30%, rgba(52, 120, 255, 0.16), transparent 30%),
    linear-gradient(135deg, #03050a, #071326 48%, #03050a);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(52, 215, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 215, 255, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent);
}

body.scheme-light {
  --bg: #f5f8fc;
  --panel: #ffffff;
  --panel-2: #eef4fb;
  --line: rgba(23, 54, 93, 0.16);
  --text: #102033;
  --muted: #5d6f86;
  --cyan: #0f4f8f;
  --blue: #123f77;
  --green: #0f766e;
  --amber: #a16207;
  --red: #b42337;
  --shadow: 0 18px 48px rgba(16, 42, 84, 0.10);
  background:
    linear-gradient(180deg, rgba(12, 53, 98, 0.07), transparent 280px),
    #f5f8fc;
}

body.scheme-light::before {
  background-image: none;
}

button, input, textarea, select {
  font: inherit;
}

button {
  color: inherit;
}

h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; }
h2 { margin-top: 6px; font-size: clamp(25px, 4vw, 47px); line-height: 1; letter-spacing: 0; }
#screenTitle { font-size: clamp(25px, 4vw, 47px); }
h3 { font-size: 22px; line-height: 1.12; }
h4 { font-size: 16px; }
p { color: var(--muted); line-height: 1.5; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.login-screen {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(520px, 100vw);
  height: 100vh;
  display: grid;
  align-items: stretch;
  padding: 18px;
  background: rgba(3, 5, 10, 0.42);
  backdrop-filter: blur(14px);
  box-shadow: -26px 0 70px rgba(0, 0, 0, 0.38);
}

.login-card {
  position: relative;
  width: 100%;
  align-self: stretch;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(13, 20, 36, 0.98), rgba(7, 19, 38, 0.96));
  box-shadow: var(--shadow);
}

.login-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.login-close:hover {
  transform: translateY(-1px);
  color: var(--text);
  border-color: rgba(52, 215, 255, 0.5);
  background: rgba(52, 215, 255, 0.1);
}

.login-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-form h2 {
  font-size: 34px;
}

.password-input-wrap {
  position: relative;
  display: block;
}

.password-input-wrap input {
  width: 100%;
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  place-items: center;
  transform: translateY(-50%);
  cursor: pointer;
}

.password-toggle:hover { color: var(--cyan); }

.auth-message {
  min-height: 22px;
  color: var(--amber);
}

.login-disclaimer {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(81, 100, 136, 0.45);
  border-radius: 8px;
  background: rgba(9, 18, 34, 0.72);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  line-height: 1.55;
}

.login-disclaimer strong {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.login-disclaimer p {
  color: inherit;
}

.login-disclaimer .disclaimer-zh {
  display: none;
  margin-bottom: 10px;
}

html[lang="zh-Hans"] .login-disclaimer .disclaimer-zh {
  display: block;
}

.auth-link {
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.auth-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
  padding: 0 4px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(5, 8, 16, 0.84);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(52, 215, 255, 0.5);
  border-radius: 12px;
  color: var(--cyan);
  font-size: 23px;
  letter-spacing: 0.5px;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(52, 215, 255, 0.12), rgba(52, 120, 255, 0.18));
  box-shadow: 0 0 30px rgba(52, 215, 255, 0.18);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 34px 0;
  flex: 1;
}

.nav-admin {
  margin-top: auto;
}

.nav button, .ghost, .primary, .tool-button, .quick-prompts button, .vision-chart button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.nav button {
  padding: 12px 14px;
  color: var(--muted);
  text-align: left;
  background: transparent;
}

.brand-mark {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  line-height: 1;
}

.brand-mark strong { font-size: 26px; }
.brand-mark span { font-size: 15.33px; font-weight: 800; letter-spacing: 0.04em; }

.brand h1 {
  font-size: 18px;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.nav-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
}

.nav-section-caret { font-size: 19px; line-height: 1; transition: transform .18s ease; }
.nav-section-toggle[aria-expanded="false"] .nav-section-caret { transform: rotate(-90deg); }
.nav-resource-group,
.nav-collapsible-group { overflow: hidden; transition: max-height .2s ease, opacity .2s ease; max-height: 280px; opacity: 1; }
.nav-resource-group.collapsed,
.nav-collapsible-group.collapsed { max-height: 0; opacity: 0; }

.nav button.nav-sub {
  width: calc(100% - 24px);
  margin-left: 24px;
  padding: 8px 12px;
  font-size: 13px;
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.02);
}

.nav-section-label {
  width: 100%;
  margin: 6px 0 2px;
  padding: 0 14px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.nav button.nav-resource {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.02);
}

.nav button.nav-sub::before,
.nav button.nav-resource::before {
  width: 18px;
  margin-right: 6px;
  opacity: 0.82;
}

html[lang="zh-Hans"] .nav button {
  font-size: 14px;
  line-height: 1.18;
  white-space: nowrap;
}

button[data-icon]::before {
  content: attr(data-icon);
  display: inline-block;
  margin-right: 8px;
}

.nav button[data-icon]::before {
  width: 22px;
  margin-right: 9px;
  text-align: center;
}

.nav button.active,
.nav button:hover {
  color: var(--text);
  background: rgba(52, 215, 255, 0.09);
  border-color: rgba(52, 215, 255, 0.36);
}

.side-panel, .command-card, .metric-card, .panel, .prompt-panel, .answer-panel, .faq-main, .faq-side {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 27, 47, 0.94), rgba(8, 14, 26, 0.94));
  box-shadow: var(--shadow);
}

.side-panel {
  padding: 18px;
  font-size: 14px;
}

.side-panel .label {
  font-size: 10px;
}

.side-panel strong {
  display: block;
  margin-top: 10px;
  font-size: 20px;
  font-weight: 500;
}

.side-panel p {
  font-size: 13px;
  line-height: 1.42;
}

.side-panel .side-copyright {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.side-privacy-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.side-privacy-link:hover { color: var(--blue); }

.privacy-panel {
  padding: 28px;
}

.privacy-panel .card-head { align-items: flex-start; }

.privacy-panel h3 {
  margin: 8px 0 0;
  font-size: clamp(24px, 3vw, 38px);
}

.privacy-intro {
  max-width: 900px;
  margin: 22px 0 26px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.privacy-sections {
  display: grid;
  gap: 18px;
  max-width: 1000px;
}

.privacy-sections section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.privacy-sections h4 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 17px;
}

.privacy-sections p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.meter {
  height: 8px;
  margin: 14px 0 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.workspace {
  position: relative;
  z-index: 1;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.system-status, .label {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions, .prompt-actions, .upload-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions {
  align-items: flex-start;
  justify-content: flex-end;
}

.session-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.scheme-control {
  min-width: 120px;
  gap: 5px;
}

.scheme-control span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.scheme-control select {
  min-height: 34px;
  max-width: 128px;
  margin: 0;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  font-weight: 400;
}

.ghost, .primary {
  min-height: 42px;
  padding: 0 16px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.ghost.active,
.ghost:hover {
  color: var(--text);
  background: rgba(52, 215, 255, 0.09);
  border-color: rgba(52, 215, 255, 0.36);
}

.top-logout {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.primary {
  border-color: rgba(52, 215, 255, 0.38);
  background: linear-gradient(135deg, rgba(52, 215, 255, 0.82), rgba(52, 120, 255, 0.82));
  color: #001528;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(52, 120, 255, 0.16);
}

.primary:hover {
  transform: translateY(-1px);
  border-color: rgba(52, 215, 255, 0.72);
  background: linear-gradient(135deg, rgba(52, 215, 255, 0.96), rgba(52, 120, 255, 0.94));
  box-shadow: 0 14px 30px rgba(52, 120, 255, 0.26), 0 0 20px rgba(52, 215, 255, 0.14);
}

.primary:active {
  transform: translateY(0);
}

.icon-only {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.icon-only::before {
  margin-right: 0;
}

.compact-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.danger {
  border-color: rgba(255, 100, 124, 0.32);
  color: #ff9bad;
}

.hero-grid, .grid-3, .admin-layout, .deal-board, .generate-layout, .template-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-role-grid {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.agent-business-dashboard {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(320px, 0.55fr);
  gap: 18px;
  align-items: stretch;
}

.business-card,
.pipeline-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 27, 47, 0.94), rgba(8, 14, 26, 0.94));
  box-shadow: var(--shadow);
  padding: 24px;
}

.business-card h3 {
  margin-top: 8px;
  font-size: 34px;
}

.business-metrics {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.business-metrics div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.business-metrics span {
  color: var(--muted);
  font-weight: 800;
}

.business-metrics strong {
  color: var(--cyan);
  font-size: 26px;
  text-align: right;
}

.pipeline-card {
  display: grid;
  align-content: center;
  gap: 14px;
}

.pipeline-card strong {
  color: var(--text);
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.95;
}

.pipeline-card p {
  color: var(--muted);
  max-width: 440px;
}

.role-dashboard-main,
.role-dashboard-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 27, 47, 0.94), rgba(8, 14, 26, 0.94));
  box-shadow: var(--shadow);
}

.role-dashboard-main {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.role-dashboard-main strong {
  color: var(--amber);
}

.role-dashboard-card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
}

.role-dashboard-card span {
  color: var(--cyan);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
}

.library-layout, .coach-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.7fr) minmax(0, 1.3fr);
  gap: 16px;
  min-height: calc(100vh - 132px);
}

.template-layout, .generate-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 0.72fr);
  gap: 16px;
  min-height: calc(100vh - 132px);
}

.user-group-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(360px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.command-card, .metric-card, .panel, .prompt-panel, .answer-panel {
  padding: 20px;
}

.clickable {
  cursor: pointer;
}

.clickable:hover, .library-card:hover, .timeline-card:hover, .template-group:hover {
  border-color: rgba(52, 215, 255, 0.5);
  transform: translateY(-1px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.chip {
  display: inline-flex;
  white-space: nowrap;
  padding: 6px 9px;
  border: 1px solid rgba(52, 215, 255, 0.28);
  border-radius: 999px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  background: rgba(52, 215, 255, 0.08);
}

.chip.live {
  color: var(--green);
  border-color: rgba(53, 242, 160, 0.34);
  background: rgba(53, 242, 160, 0.08);
}

.workflow-map {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 26px 0;
}

.node {
  min-width: 92px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 800;
}

.node.active {
  color: var(--cyan);
  border-color: rgba(52, 215, 255, 0.48);
}

.node.warn {
  color: var(--amber);
  border-color: rgba(255, 200, 90, 0.52);
}

.line {
  height: 2px;
  background: linear-gradient(90deg, rgba(52, 215, 255, 0.2), rgba(52, 215, 255, 0.7));
}

.support-copy {
  max-width: 760px;
}

.metric-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 38px;
  color: var(--text);
}

.panel h3 {
  margin: 10px 0 8px;
}

textarea, input, select {
  width: 100%;
  border: 1px solid rgba(120, 205, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 170px;
  margin: 18px 0 14px;
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
}

.clause-intro-inline {
  flex: 1;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.clause-intro-inline + .chip {
  margin-top: 2px;
}

[data-screen="clauses"] .case-search {
  margin-top: 30px;
}

#questionInput {
  min-height: 132px;
  height: 132px;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

input, select {
  min-height: 42px;
  padding: 9px 11px;
}

select option {
  background: #0d1424;
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.quick-prompts button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(255, 255, 255, 0.04);
}

.quick-button-icon {
  flex: 0 0 auto;
  color: var(--cyan);
}

.quick-button-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-prompts button:hover {
  color: var(--text);
  border-color: rgba(52, 215, 255, 0.4);
}

.quick-prompt-manager {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(52, 215, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.quick-manager-header,
.quick-manager-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.quick-manager-header strong {
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


#quickPromptSearchInput {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background: rgba(2, 6, 23, 0.55) !important;
  background-color: rgba(2, 6, 23, 0.55) !important;
  background-clip: padding-box;
  color: var(--text) !important;
  caret-color: var(--cyan);
  box-shadow: inset 0 0 0 9999px rgba(2, 6, 23, 0.08);
}

#quickPromptSearchInput:focus {
  border-color: rgba(52, 215, 255, 0.45);
  background: rgba(2, 6, 23, 0.72) !important;
  background-color: rgba(2, 6, 23, 0.72) !important;
}

#quickPromptSearchInput:-webkit-autofill,
#quickPromptSearchInput:-webkit-autofill:hover,
#quickPromptSearchInput:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px #101827 inset;
  caret-color: var(--cyan);
}

#quickPromptSearchInput::-webkit-search-cancel-button,
#quickPromptSearchInput::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.8);
}

.quick-manager-list {
  display: grid;
  gap: 8px;
}

.quick-manager-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.quick-manager-row > button:first-child {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(120, 205, 255, 0.16);
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.quick-manager-row strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan);
  font-size: 12px;
}

.quick-manager-row .quick-manager-prompt {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer-panel {
  min-height: 100%;
}

.coach-screen .answer-panel {
  display: grid;
  align-content: start;
}

.answer-disclaimer {
  margin-top: 10px;
}

.answer-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#openAiKeyButton {
  min-height: 30px;
  padding: 0 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}
.openai-key-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.45fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
}

.openai-key-panel.hidden {
  display: none;
}

.openai-key-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.openai-key-panel input,
.openai-key-panel select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.55);
  color: var(--text);
  padding: 0 10px;
}

#closeOpenAiKeyPanelButton {
  justify-self: end;
}

.openai-key-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.openai-key-panel .wide {
  grid-column: span 2;
}

.openai-key-panel .hidden {
  display: none;
}

.answer-warning {
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  color: #fde68a;
  background: rgba(250, 204, 21, 0.08);
}

@media (max-width: 720px) {
  .openai-key-panel {
    grid-template-columns: 1fr;
  }
}

.coach-history {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.history-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.history-card:hover {
  border-color: rgba(52, 215, 255, 0.48);
  background: rgba(52, 215, 255, 0.08);
}

.history-card span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.history-card strong {
  font-size: 13px;
  line-height: 1.35;
}

.admin-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.text-link {
  border: 0;
  padding: 0;
  color: var(--cyan);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.user-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.security-grid-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.security-grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  font-size: 13px;
}

.security-grid th {
  padding: 9px 10px;
  color: #ffffff;
  text-align: left;
  background: #22679d;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
}

.security-grid td {
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  white-space: nowrap;
}

.security-grid tbody tr:first-child td {
  background: rgba(255, 200, 90, 0.18);
}

.disclaimer {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 200, 90, 0.34);
  border-radius: 8px;
  color: #ffe0a3;
  background: rgba(255, 200, 90, 0.08);
  font-size: 13px;
  line-height: 1.5;
}

.answer-body {
  height: max(300px, 42vh);
  min-height: 300px;
  max-height: calc(100vh - 420px);
  padding: 18px;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  border: 1px solid rgba(120, 205, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.answer-body ul {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--text);
}

.answer-body li {
  margin: 8px 0;
}

.answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 16px;
  margin-top: 16px;
}

.source-matches, .queue-list, .step-list, .library-list, .source-list, .pricing-bars, .template-groups, .template-files {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.step-list div, .queue-list div, .source-list div, .pricing-bars div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.step-list span {
  color: var(--cyan);
  font-weight: 900;
}

.match-card, .library-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.card-actions {
  display: flex;
  align-items: start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.match-card strong, .library-card h4 {
  display: block;
  margin: 8px 0 6px;
}

.related-sources-panel {
  grid-template-columns: 1fr;
}

.source-matches {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.source-matches .match-card {
  grid-template-columns: 1fr;
}

.source-matches .match-card strong {
  margin-top: 0;
  line-height: 1.2;
}

.match-card p, .match-card small, .library-card p, .library-card small, .empty {
  color: var(--muted);
  font-size: 13px;
}

.upload-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.deal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.generate-note {
  margin: 12px 0 16px;
  color: #c46a00;
  background: #ffffff;
  border: 1px solid rgba(196, 106, 0, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}

.title-warning {
  width: 100%;
  max-width: none;
  margin: 4px 0 0;
}

body:not(.scheme-light) .generate-note {
  background: #101b2d;
  border-color: rgba(255, 166, 70, 0.5);
  color: #f2a23a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.deal-form textarea {
  min-height: 96px;
  margin: 0;
}

.template-group {
  border: 1px solid rgba(120, 205, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.template-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px;
  cursor: pointer;
}

.template-group summary strong,
.template-file-list button span,
.download-row span {
  display: block;
  color: var(--text);
  line-height: 1.25;
}

.template-group summary small,
.template-file-list button small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.template-group summary em {
  color: var(--cyan);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.template-file-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.template-file-list button,
.download-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
}

.template-file-list button:hover,
.template-file-list button.selected,
.download-row:hover,
.download-row.selected {
  border-color: rgba(52, 215, 255, 0.48);
  background: rgba(52, 215, 255, 0.08);
}

.download-row.locked-download {
  width: 100%;
  text-align: left;
}

.locked-download strong {
  color: var(--amber);
}

[data-screen="templates"] .detail-panel {
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 56px);
  overflow: auto;
}

.download-row strong {
  color: var(--cyan);
  white-space: nowrap;
  font-size: 12px;
}

.pdf-preview-card {
  display: grid;
  gap: 14px;
}

.pdf-preview-frame {
  min-height: 520px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(120, 205, 255, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.pdf-preview-frame iframe {
  width: 100%;
  height: 520px;
  border: 0;
  background: #ffffff;
}

.pdf-preview-canvas {
  width: 100%;
  height: 520px;
  overflow: auto;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 16px;
  padding: 14px;
  user-select: none;
}

.pdf-preview-page {
  display: block;
  max-width: 100%;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.pdf-preview-loading {
  color: var(--muted);
  margin: 18px;
}

.answer-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 8px 0;
}

.answer-loading .hourglass {
  display: inline-block;
  font-size: 22px;
  animation: hourglass-spin 1.25s linear infinite;
}

@keyframes hourglass-spin {
  0%, 35% { transform: rotate(0deg); }
  50%, 85% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

.pdf-preview-locked {
  width: min(320px, 84%);
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 28px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  color: #162033;
  text-align: center;
  background: linear-gradient(180deg, #ffffff, #edf4fb);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

.pdf-page-mini {
  width: 112px;
  height: 150px;
  border: 1px solid #cbd5e1;
  background:
    linear-gradient(#e11d48 0 3px, transparent 3px 18px),
    repeating-linear-gradient(180deg, transparent 0 16px, #dbe5ef 16px 18px),
    #ffffff;
}

.pdf-preview-locked strong {
  color: #162033;
  line-height: 1.3;
}

.pdf-preview-locked small {
  color: #0f4f8f;
  font-weight: 900;
}

.pdf-preview-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.template-auth-notice {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.pdf-preview-controls .ghost,
.pdf-preview-controls .download-action {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  text-decoration: none;
}

.print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.wide {
  grid-column: 1 / -1;
}

.file-drop {
  min-height: 150px;
  place-items: center;
  border: 1px dashed rgba(52, 215, 255, 0.42);
  border-radius: 8px;
  background: rgba(52, 215, 255, 0.055);
  color: var(--cyan);
  cursor: pointer;
  text-align: center;
}

.file-drop input {
  max-width: 360px;
  border: 0;
  background: transparent;
}

.search-input {
  margin: 8px 0 12px;
}

.search-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, 42px);
  align-items: stretch;
  gap: 8px;
  margin: 8px 0 12px;
}

.search-tools .search-input,
.case-search.search-tools input,
.kb-search.search-tools input {
  min-width: 0;
  margin: 0;
}

.tool-button {
  min-width: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--cyan);
  font-weight: 900;
  background: rgba(52, 215, 255, 0.08);
}

.tool-button:hover {
  color: var(--text);
  border-color: rgba(52, 215, 255, 0.52);
  background: rgba(52, 215, 255, 0.15);
}

.search-glyph {
  width: 14px;
  height: 14px;
  display: inline-block;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.search-glyph::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  background: currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
  transform-origin: left center;
}

.detail-panel {
  min-height: calc(100vh - 132px);
}

.detail-text {
  min-height: 420px;
  max-height: calc(100vh - 310px);
  margin-top: 16px;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  color: #cce9ff;
  border: 1px solid rgba(120, 205, 255, 0.16);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.workflow-mode-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 16px;
}

.workflow-mode-bar .ghost {
  min-width: 126px;
  justify-content: center;
}

.timeline-card {
  min-height: 138px;
  padding: 14px;
  border: 1px solid rgba(52, 215, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.timeline-card.selected {
  border-color: rgba(52, 215, 255, 0.72);
  background: rgba(52, 215, 255, 0.08);
}

.timeline-card span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.timeline-card h4 {
  margin: 10px 0 8px;
}

.timeline-card p {
  font-size: 12px;
}

.workflow-upload-panel {
  display: grid;
  gap: 14px;
}

.workflow-upload-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.workflow-analysis {
  min-height: 82px;
}

.workflow-analysis-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(52, 215, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.workflow-analysis-card h4 {
  margin: 0;
}

.workflow-analysis-card p {
  margin: 0;
  color: var(--muted);
}

.workflow-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.workflow-analysis-grid ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.knowledge-hero {
  min-height: 230px;
  display: grid;
  place-items: center;
  gap: 26px;
  margin: -4px -4px 28px;
  padding: 42px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 42, 38, 0.92), rgba(5, 72, 68, 0.88)),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 28px, transparent 28px 82px);
  box-shadow: var(--shadow);
}

.knowledge-hero h3 {
  color: #ffffff;
  font-size: clamp(32px, 5vw, 58px);
  text-align: center;
}

.kb-search {
  width: min(760px, 92vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.kb-search input {
  min-height: 58px;
  border: 0;
  border-radius: 0;
  color: #172521;
  background: #ffffff;
  padding: 0 24px;
}

.kb-search button {
  min-height: 58px;
  border-radius: 0;
  padding: 0 28px;
  background: #438a78;
  color: #ffffff;
}

.kb-search.search-tools {
  grid-template-columns: minmax(0, 1fr) repeat(4, 54px);
}

.kb-search.search-tools .tool-button {
  min-width: 54px;
  min-height: 52px;
  padding: 0;
  border-top: 0;
  border-bottom: 0;
  border-right: 0;
  border-left-color: rgba(15, 79, 143, 0.16);
  border-radius: 0;
  color: #ffffff;
  background: var(--blue);
}

[data-screen="faq"] {
  --cyan: #2563eb;
  --blue: #1d4ed8;
}

[data-screen="faq"] .knowledge-hero {
  min-height: 128px;
  padding: 30px 24px;
  background:
    linear-gradient(135deg, rgba(2, 14, 23, 0.98), rgba(5, 64, 78, 0.94)),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.10) 0 28px, transparent 28px 82px);
}

[data-screen="faq"] .knowledge-hero h3 {
  display: none;
}

[data-screen="faq"] .kb-search button,
[data-screen="faq"] .primary {
  background: #2563eb;
  color: #ffffff;
}

[data-screen="faq"] .kb-search {
  width: min(720px, 72vw);
}

[data-screen="faq"] .kb-search input,
[data-screen="faq"] .kb-search button {
  min-height: 52px;
}

[data-screen="faq"] .faq-tabs button.active,
[data-screen="faq"] .faq-tabs button:hover {
  border-bottom-color: #2563eb;
}

[data-screen="faq"] .faq-item span,
[data-screen="faq"] .topic-list button:hover,
[data-screen="faq"] .label,
[data-screen="faq"] .faq-stat strong {
  color: #2563eb;
}

.faq-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.7fr);
  gap: 24px;
}

.resource-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.partners-layout {
  display: grid;
  gap: 24px;
}

.penalty-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.record-browser-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.faq-main, .faq-side {
  padding: 20px;
}

.faq-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.faq-tabs button,
.topic-list button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.faq-tabs button {
  min-height: 36px;
  padding: 0 4px;
  border-bottom: 2px solid transparent;
}

.faq-tabs button.active,
.faq-tabs button:hover {
  color: var(--text);
  border-bottom-color: var(--cyan);
}

.faq-list {
  display: grid;
}

.faq-item {
  padding: 22px 10px;
  border-bottom: 1px solid var(--line);
}

.faq-item span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.faq-item h4 {
  margin: 8px 0;
  font-size: 19px;
}

.faq-side {
  display: grid;
  align-content: start;
  gap: 18px;
  border-left: 1px solid var(--line);
}

.faq-stat {
  display: grid;
  place-items: center;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

.faq-stat strong {
  font-size: 32px;
}

.topic-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.topic-list button {
  width: 100%;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.resource-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.resource-row.selected,
.resource-row:hover {
  border-color: rgba(52, 215, 255, 0.62);
  background: rgba(52, 215, 255, 0.10);
}

.resource-row strong,
.partner-card strong {
  display: block;
  line-height: 1.25;
}

.partner-card strong {
  min-height: 44px;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: normal;
}

.resource-row small,
.partner-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.partner-card span {
  overflow-wrap: anywhere;
  white-space: normal;
}

.resource-row em {
  color: var(--cyan);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.resource-detail-panel {
  position: sticky;
  top: 28px;
}

.resource-image {
  width: 100%;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.partner-jump {
  min-width: min(340px, 100%);
}

.partner-jump span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.partner-category-sections {
  display: grid;
  gap: 34px;
  margin-top: 22px;
}

.partner-category {
  scroll-margin-top: 30px;
}

.partner-category h4 {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 28px;
}

.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 240px);
  justify-content: start;
  gap: 16px;
}

.partner-card {
  display: flex;
  height: 340px;
  padding: 16px;
  border: 1px solid rgba(52, 215, 255, 0.22);
  border-radius: 12px;
  background:
    radial-gradient(circle at top left, rgba(52, 215, 255, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(8, 24, 42, 0.98), rgba(4, 10, 20, 0.98));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  flex-direction: column;
}

.partner-card img {
  width: 100%;
  height: 118px;
  object-fit: contain;
  margin-bottom: 12px;
  border: 1px solid rgba(52, 215, 255, 0.24);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(5, 16, 31, 0.96), rgba(10, 35, 61, 0.96));
}

.partner-card p {
  flex: 1;
  margin: 10px 0 0;
  padding-right: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow: auto;
  overflow-wrap: anywhere;
}

.case-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 18px 0 14px;
}

.case-search.search-tools {
  grid-template-columns: minmax(0, 1fr) repeat(4, 42px);
}

.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.case-tabs button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-weight: 800;
}

.case-tabs button.active,
.case-tabs button:hover {
  color: var(--text);
  border-color: rgba(37, 99, 235, 0.52);
  background: rgba(37, 99, 235, 0.12);
}

.case-count {
  margin-top: 12px;
}

.case-list,
.penalty-cases {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.case-row,
.penalty-case {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.case-row.selected,
.case-row:hover {
  border-color: rgba(37, 99, 235, 0.62);
  background: rgba(37, 99, 235, 0.10);
}

.case-row strong {
  display: block;
  line-height: 1.25;
}

.case-row small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.case-row p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.case-row em {
  color: var(--cyan);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.case-detail-panel {
  position: sticky;
  top: 28px;
  min-height: calc(100vh - 132px);
  max-height: calc(100vh - 56px);
  overflow: auto;
}

.case-detail {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.case-detail dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.case-detail dl div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.case-detail dt {
  color: var(--muted);
  font-weight: 900;
}

.case-detail dd {
  margin: 0;
  color: var(--text);
}

.penalty-case > span {
  color: var(--cyan);
  font-weight: 900;
}

.penalty-case h4 {
  margin-bottom: 8px;
}

.penalty-case p + p {
  margin-top: 8px;
}

body.scheme-light .sidebar {
  background: rgba(255, 255, 255, 0.96);
  border-right-color: rgba(23, 54, 93, 0.14);
  backdrop-filter: none;
}

body.scheme-light .brand-mark {
  color: #0f4f8f;
  border-color: #cfe0f5;
  background: #edf5ff;
  box-shadow: none;
}

body.scheme-light .side-panel,
body.scheme-light .command-card,
body.scheme-light .metric-card,
body.scheme-light .panel,
body.scheme-light .prompt-panel,
body.scheme-light .answer-panel,
body.scheme-light .faq-main,
body.scheme-light .faq-side,
body.scheme-light .role-dashboard-main,
body.scheme-light .role-dashboard-card,
body.scheme-light .business-card,
body.scheme-light .pipeline-card {
  background: #ffffff;
  border-color: rgba(23, 54, 93, 0.14);
  box-shadow: var(--shadow);
}

body.scheme-light .side-panel .side-copyright,
body.scheme-light .privacy-intro,
body.scheme-light .privacy-sections p { color: #52657d; }

body.scheme-light .side-privacy-link { color: #0f63a8; }

body.scheme-light .login-card {
  background: #ffffff;
}

body.scheme-light .login-screen {
  background: rgba(226, 235, 247, 0.56);
}

body.scheme-light .login-disclaimer {
  color: rgba(255, 255, 255, 0.94);
  background: #4b5563;
  border-color: rgba(75, 85, 99, 0.32);
}

body.scheme-light .workspace {
  background: transparent;
}

body.scheme-light .nav button,
body.scheme-light .ghost,
body.scheme-light .quick-prompts button,
body.scheme-light .quick-prompt-manager,
body.scheme-light .quick-manager-row > button:first-child,
body.scheme-light .case-tabs button,
body.scheme-light .case-row,
body.scheme-light textarea,
body.scheme-light input,
body.scheme-light select,
body.scheme-light .answer-body,
body.scheme-light .step-list div,
body.scheme-light .queue-list div,
body.scheme-light .source-list div,
body.scheme-light .pricing-bars div,
body.scheme-light .match-card,
body.scheme-light .library-card,
body.scheme-light .template-group,
body.scheme-light .template-file-list button,
body.scheme-light .download-row,
body.scheme-light .timeline-card,
body.scheme-light .workflow-analysis-card {
  background: #f9fbff;
  border-color: rgba(23, 54, 93, 0.14);
}

body.scheme-light .security-grid td {
  background: #ffffff;
}

body.scheme-light .security-grid tbody tr:first-child td {
  background: #fff6d6;
}

body.scheme-light .nav button.active,
body.scheme-light .nav button:hover,
body.scheme-light .timeline-card.selected,
body.scheme-light .download-row:hover,
body.scheme-light .download-row.selected {
  background: #eaf3ff;
  border-color: rgba(15, 79, 143, 0.38);
}

body.scheme-light .primary {
  background: linear-gradient(135deg, #0f4f8f, #123f77);
  color: #ffffff;
}

body.scheme-light [data-screen="faq"] .primary,
body.scheme-light [data-screen="faq"] .kb-search button {
  background: #123f77;
  color: #ffffff;
}

body.scheme-light .chip {
  background: #edf5ff;
  border-color: #cfe0f5;
}

body.scheme-light .detail-text {
  color: #21322e;
  background: #f9fbff;
  border-color: rgba(23, 54, 93, 0.14);
}

body.scheme-light select option {
  background: #ffffff;
}

body.scheme-light .disclaimer {
  color: #6f4f00;
  background: #fff8e6;
  border-color: #f0d58a;
}

body.scheme-light [data-screen="faq"] .knowledge-hero {
  background: #f9fbff;
  border-color: rgba(23, 54, 93, 0.14);
  box-shadow: var(--shadow);
}

body.scheme-light [data-screen="faq"] .knowledge-hero h3 {
  display: none;
}

body.scheme-light [data-screen="faq"] .knowledge-hero {
  min-height: 128px;
  padding: 30px 24px;
}

.hidden {
  display: none !important;
}

.search-hit {
  display: inline;
  padding: 0 3px;
  border-radius: 3px;
  color: #06121f;
  background: #f8d86a;
  box-shadow: 0 0 0 1px rgba(248, 216, 106, 0.35);
}

body.scheme-light .search-hit {
  color: #0f172a;
  background: #fde68a;
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.22);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .hero-grid, .grid-3, .dashboard-role-grid, .agent-business-dashboard, .admin-layout, .deal-board, .library-layout, .coach-layout, .answer-grid, .template-layout, .generate-layout, .faq-layout, .resource-layout, .partners-layout, .penalty-layout, .record-browser-layout, .user-group-layout {
    grid-template-columns: 1fr;
  }

  .faq-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .span-2,
  .span-3 {
    grid-column: auto;
  }

  .workflow-map {
    grid-template-columns: 1fr;
  }

  .line {
    height: 20px;
    width: 2px;
    justify-self: center;
  }

  .timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-upload-bar,
  .workflow-analysis-grid {
    grid-template-columns: 1fr;
  }

  .user-create-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace, .sidebar {
    padding: 18px;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  .topbar, .card-head, .match-card, .library-card {
    display: grid;
    min-width: 0;
  }

  h2 {
    overflow-wrap: anywhere;
  }

  .nav,
  .nav button,
  .side-panel,
  .top-actions,
  .screen {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .kb-search {
    grid-template-columns: 1fr;
    border-radius: 8px;
  }

  .search-tools,
  .case-search.search-tools,
  .kb-search.search-tools {
    grid-template-columns: minmax(0, 1fr) repeat(4, 38px);
  }

  .tool-button,
  .kb-search.search-tools .tool-button {
    min-width: 38px;
  }

  .upload-form, .deal-form, .timeline {
    grid-template-columns: 1fr;
  }

  .quick-manager-header,
  .quick-manager-toolbar,
  .quick-manager-row,
  .source-matches,
  .related-sources-panel,
  .pdf-preview-controls {
    grid-template-columns: 1fr;
  }
}












:where(.visually-hidden) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
