﻿:root {
  --bg: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --danger: #dc4458;
  --card: #ffffff;
  --border: #dbe4ee;
  --panel: #f8fafc;
  --panel-2: #f1f5f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #ffffff;
  font-family: "IBM Plex Sans", "Source Han Sans SC", "PingFang SC", sans-serif;
  overflow-x: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

label {
  display: block;
  font-size: 14px;
  color: var(--muted);
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #93c5fd;
  color: #2563eb;
  background: #eff6ff;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  cursor: help;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
}

select {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid color-mix(in oklab, var(--accent) 36%, transparent);
  border-color: var(--accent);
}

button,
.link-btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  color: #fff;
  background: var(--accent);
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s ease, filter 0.2s ease;
}

button:hover,
.link-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.12);
}

.secondary-btn {
  color: #2563eb;
  background: #ffffff;
  border: 1px solid var(--border);
  min-height: 32px;
  padding: 5px 12px;
  line-height: 20px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.account-name {
  max-width: 180px;
  color: var(--muted);
  font-size: 13px;
  line-height: 32px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-link {
  padding: 8px 12px;
}

.role-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.role-nav a {
  color: #2563eb;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
}

.role-nav a.active {
  color: #fff;
  border-color: transparent;
  background: var(--accent);
}

.top-app-nav {
  width: 100vw;
  min-height: 68px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: -16px calc((100% - 100vw) / 2) 14px;
  padding: 0 clamp(24px, 4vw, 56px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035);
}

.page > .top-app-nav {
  margin-top: -26px;
}

.upload-module-page > .top-app-nav,
.chat-shell > .top-app-nav {
  margin-top: -16px;
}

.top-app-brand {
  color: #172033;
  font-size: 16px;
  padding-right: 26px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.top-module-nav {
  margin-top: 0;
  gap: 12px;
  justify-content: flex-start;
}

.top-module-nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  border-color: transparent;
  background: transparent;
  color: #334155;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 400;
}

.top-module-nav a:hover {
  color: #2563eb;
  background: #eff6ff;
}

.top-module-nav a.active {
  color: #ffffff;
  background: #0b63d8;
  box-shadow: 0 8px 18px rgba(11, 99, 216, 0.2);
}

.top-app-nav + .module-header {
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 18px 4px 14px;
  box-shadow: none;
}

.top-actions,
.sidebar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

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

.page {
  width: min(1100px, calc(100% - 48px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.page.narrow {
  width: min(860px, calc(100% - 48px));
}

.hero {
  margin-bottom: 18px;
}

.page-hero,
.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}

.module-page {
  width: min(1180px, calc(100% - 48px));
}

.upload-module-page {
  width: calc(100% - 32px);
  max-width: none;
  min-height: 100vh;
  padding: 16px 0 24px;
}

.upload-module-page .upload-card {
  min-height: calc(100vh - 164px);
  display: flex;
  flex-direction: column;
}

.upload-module-page .upload-card form {
  flex: 0 0 auto;
}

.upload-module-page .result {
  flex: 1;
}

.module-header {
  min-height: 116px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.module-header h1 {
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.18;
}

.module-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: #2563eb;
  display: inline-grid;
  place-items: center;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  background: var(--panel-2);
  transform: translateY(-1px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.28);
  padding: 24px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop.modal-backdrop-front {
  z-index: 1010;
}

.modal-card {
  width: min(440px, 100%);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.18);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header h2 {
  font-size: 22px;
}

.modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 22px;
  line-height: 1;
}

.modal-form {
  display: grid;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-dialog {
  width: min(460px, calc(100vw - 48px));
}

.confirm-message {
  margin: 6px 0 18px;
  color: #334155;
  line-height: 1.7;
}

.modal-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.eyebrow {
  letter-spacing: 0.2em;
  font-weight: 400;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 8px;
}

.hero h1 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.18;
  margin-bottom: 0;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.upload-card form {
  display: grid;
  gap: 12px;
}

.workspace-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  width: min(880px, 100%);
  margin: clamp(44px, 12vh, 118px) auto 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.workspace-item {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 6px;
  min-height: 156px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.workspace-item-blue {
  background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
}

.workspace-item-green {
  background: linear-gradient(135deg, #ffffff 0%, #f6fbf7 100%);
}

.workspace-item-purple {
  background: linear-gradient(135deg, #ffffff 0%, #f8f6ff 100%);
}

.workspace-item::after {
  content: none;
}

.workspace-item:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.08);
}

.workspace-kicker {
  display: none;
}

.workspace-item strong {
  display: block;
  font-size: 25px;
}

.workspace-item small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.workspace-item-green .workspace-kicker {
  color: #047857;
  background: #ecfdf5;
}

.workspace-item-purple .workspace-kicker {
  color: #6d28d9;
  background: #f5f3ff;
}

.kb-picker {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
}

.kb-picker select {
  margin-top: 0;
}

.file-picker {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-picker input {
  margin-top: 0;
  display: none;
}

.file-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result {
  margin-top: 14px;
  min-height: 44px;
  white-space: pre-wrap;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
}

.kb-console-header {
  min-height: 118px;
}

.module-subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.kb-workbench-tabs {
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 9px 12px;
  overflow: auto hidden;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035);
}

.kb-workbench-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  color: #334155;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 400;
}

.kb-workbench-tabs button span {
  color: #64748b;
  font-weight: 400;
}

.kb-workbench-tabs button:hover,
.kb-workbench-tabs button.active {
  color: #ffffff;
  background: #0b63d8;
  transform: none;
  filter: none;
  box-shadow: 0 8px 18px rgba(11, 99, 216, 0.2);
}

.kb-workbench-tabs button:hover span,
.kb-workbench-tabs button.active span {
  color: #ffffff;
}

.kb-tab-panel[hidden] {
  display: none !important;
}

.kb-feature-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  min-height: calc(100vh - 256px);
}

.kb-graph-panel,
.kb-security-main,
.kb-push-main,
.kb-graph-aside section,
.kb-security-side section,
.kb-push-side section,
.kb-push-control-panel,
.kb-push-filter-row,
.kb-push-queue-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 32, 51, 0.04);
}

.kb-graph-panel,
.kb-security-main,
.kb-push-main {
  min-width: 0;
  padding: 18px;
}

.kb-graph-head,
.kb-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.kb-graph-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.kb-graph-legend strong,
.kb-section-title strong,
.kb-push-control-panel strong,
.kb-push-filter-row > strong,
.kb-graph-aside strong,
.kb-security-side strong,
.kb-push-side strong {
  color: #26384d;
  font-size: 14px;
  font-weight: 400;
}

.kb-graph-legend span {
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
}

.kb-graph-legend span::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #60a5fa;
}

.kb-graph-legend .tag::before {
  background: #34d399;
}

.kb-graph-legend .document::before {
  background: #a78bfa;
}

.kb-graph-search {
  width: min(320px, 100%);
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.kb-graph-search input {
  height: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.kb-graph-controls,
.kb-push-strategy-tabs,
.kb-push-filter-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.kb-graph-controls button,
.kb-push-strategy-tabs button,
.kb-push-filter-row button {
  min-height: 30px;
  border: 1px solid #d8e5f4;
  border-radius: 999px;
  color: #334155;
  background: #ffffff;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 400;
}

.kb-graph-controls button:hover,
.kb-graph-controls button.active,
.kb-push-strategy-tabs button:hover,
.kb-push-strategy-tabs button.active,
.kb-push-filter-row button:hover,
.kb-push-filter-row button.active {
  border-color: #93c5fd;
  color: #0b63d8;
  background: #eaf2ff;
  transform: none;
  filter: none;
}

.kb-push-filter-row button em {
  color: #0b63d8;
  font-style: normal;
  font-size: 12px;
}

.kb-graph-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kb-graph-metrics article {
  border: 1px solid #e5edf6;
  border-radius: 10px;
  background: #f8fbff;
  padding: 12px;
}

.kb-graph-metrics small,
.kb-section-title span {
  color: var(--muted);
  font-size: 12px;
}

.kb-graph-metrics strong {
  display: block;
  margin-top: 4px;
  color: #071a33;
  font-size: 20px;
  font-weight: 400;
}

.kb-graph-canvas {
  position: relative;
  min-height: 520px;
  border: 1px solid #e6edf5;
  border-radius: 12px;
  background:
    linear-gradient(#eef4fb 1px, transparent 1px),
    linear-gradient(90deg, #eef4fb 1px, transparent 1px),
    #fbfdff;
  background-size: 28px 28px;
  overflow: hidden;
}

.kb-graph-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.kb-graph-canvas line {
  stroke: #bfd1e6;
  stroke-width: 0.35;
}

.kb-graph-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 118px;
  min-height: 64px;
  border: 1px solid #d8e5f4;
  border-radius: 14px;
  color: #203047;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.kb-graph-node span {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #0b63d8;
  background: #eaf2ff;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 400;
}

.kb-graph-node.tag span {
  color: #047857;
  background: #dcfce7;
}

.kb-graph-node.document span {
  color: #6d28d9;
  background: #f3e8ff;
}

.kb-graph-node strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 400;
}

.kb-graph-node.active {
  border-color: #0b63d8;
  box-shadow: 0 12px 26px rgba(11, 99, 216, 0.18);
}

.kb-graph-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.kb-graph-aside,
.kb-security-side,
.kb-push-side {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

.kb-graph-aside section,
.kb-security-side section,
.kb-push-side section {
  padding: 16px;
}

.kb-graph-aside span {
  color: var(--muted);
  font-size: 12px;
}

.kb-graph-aside h3 {
  margin-top: 8px;
  color: #26384d;
  font-size: 16px;
  font-weight: 400;
}

.kb-graph-aside p,
.kb-security-side p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
}

.kb-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.kb-tag-cloud button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  color: #2563eb;
  background: #eaf2ff;
  padding: 0 10px;
  font-size: 12px;
}

.kb-tag-cloud button:hover,
.kb-tag-cloud button.active {
  color: #ffffff;
  background: #2563eb;
  transform: none;
  filter: none;
}

.kb-security-side dl {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
}

.kb-security-side dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kb-security-side dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.kb-security-side dd {
  margin: 0;
  color: #0b63d8;
  font-size: 20px;
  font-weight: 400;
}

.kb-bulk-permission-panel {
  border: 1px solid #e6edf5;
  border-radius: 10px;
  background: #f8fbff;
  margin-bottom: 14px;
  padding: 14px;
}

.kb-bulk-permission-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.kb-bulk-permission-head strong,
.kb-bulk-permission-head span {
  display: block;
}

.kb-bulk-permission-head strong,
.kb-security-side section > strong,
#securityPanel .kb-section-title strong {
  color: #334155;
  font-size: 14px;
  font-weight: 400;
}

#securityPanel .kb-section-title span {
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

.kb-bulk-permission-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.kb-bulk-permission-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kb-bulk-permission-controls label {
  flex: 0 0 240px;
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

.kb-bulk-permission-controls select {
  height: 40px;
  margin-top: 0;
  font-size: 13px;
  font-weight: 400;
}

.kb-bulk-permission-checks {
  display: flex;
  flex-wrap: wrap;
  flex: 0 1 auto;
  gap: 8px;
  padding-bottom: 2px;
}

.kb-bulk-permission-controls > button {
  height: 34px;
  min-height: 34px;
  align-self: center;
  border-radius: 9px;
  background: #0b63d8;
  box-shadow: 0 8px 18px rgba(11, 99, 216, 0.2);
  color: #ffffff;
  font-size: 13px;
  font-weight: 400;
  padding: 0 13px;
  white-space: nowrap;
}

.kb-bulk-permission-controls > button:hover {
  background: #0b63d8;
  transform: none;
  filter: none;
}

.kb-bulk-permission-item {
  min-height: 32px;
  border: 1px solid #d8e5f4;
  border-radius: 999px;
  color: #334155;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.kb-bulk-permission-item input {
  width: auto;
  margin: 0;
  accent-color: #60a5fa;
}

.kb-bulk-empty {
  color: var(--muted);
  font-size: 13px;
}

.kb-permission-matrix {
  border: 1px solid #e6edf5;
  border-radius: 10px;
  overflow: auto;
}

.kb-permission-filters {
  border-bottom: 1px solid #e6edf5;
  background: #ffffff;
  display: flex;
  padding: 12px 14px;
}

.kb-permission-filters input {
  width: min(420px, 100%);
  min-height: 36px;
  border: 1px solid #d8e5f4;
  border-radius: 9px;
  color: #334155;
  background: #ffffff;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 400;
}

.kb-permission-table {
  width: 100%;
  min-width: 980px;
}

.kb-permission-row {
  display: grid;
  grid-template-columns: 140px 130px 150px repeat(var(--kb-count), minmax(112px, 1fr));
  align-items: stretch;
  border-bottom: 1px solid #e6edf5;
}

.kb-permission-row.head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  color: #52637a;
  font-size: 13px;
  font-weight: 400;
}

.kb-permission-row > span,
.kb-permission-check {
  min-height: 56px;
  border-right: 1px solid #e6edf5;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 400;
}

.kb-permission-row.head > span:nth-child(n + 4) {
  justify-content: center;
  text-align: center;
}

.kb-permission-column-filter {
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.kb-permission-column-filter > span:not(.kb-permission-filter-control) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-permission-filter-control {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
}

.kb-permission-filter-button {
  width: 18px;
  height: 18px;
  min-height: 18px;
  border: 0;
  border-radius: 4px;
  color: #52637a;
  background: transparent;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  cursor: pointer;
  transform: none;
  filter: none;
}

.kb-permission-filter-button::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.25px solid currentColor;
  border-bottom: 1.25px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.kb-permission-filter-button:hover,
.kb-permission-filter-button:focus,
.kb-permission-column-filter.active .kb-permission-filter-button {
  background: #eff6ff;
  color: #2563eb;
  transform: none;
  filter: none;
}

.kb-permission-filter-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 30;
  display: none;
  width: max-content;
  min-width: 118px;
  max-width: 180px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #d8e5f4;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
  padding: 6px;
  text-align: left;
  transform: translateX(-50%);
}

.kb-permission-filter-menu.open {
  display: grid;
  gap: 2px;
}

.kb-permission-filter-menu button {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  color: #334155;
  background: #ffffff;
  display: block;
  margin: 0;
  padding: 0 10px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 400;
  transform: none;
  filter: none;
}

.kb-permission-filter-menu button:hover,
.kb-permission-filter-menu button:focus {
  color: #2563eb;
  background: #eff6ff;
  transform: none;
  filter: none;
}

.kb-permission-filter-menu button.active {
  color: #1d4ed8;
  background: #eaf2ff;
}

.kb-permission-text-cell {
  display: block !important;
  min-width: 0;
  overflow: hidden;
  line-height: 56px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-permission-user {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  gap: 3px;
}

.kb-permission-user strong {
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-permission-user small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-permission-check {
  justify-content: center;
}

.kb-permission-check input {
  display: none;
}

.kb-permission-check span {
  width: 34px;
  height: 22px;
  border-radius: 999px;
  background: #eaf2ff;
  position: relative;
}

.kb-permission-check span::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  transition: transform 0.18s ease;
}

.kb-permission-check input:checked + span {
  background: #bfdbfe;
}

.kb-permission-check input:checked + span::before {
  background: #60a5fa;
}

.kb-permission-check input:checked + span::before {
  transform: translateX(12px);
}

.kb-push-main {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.kb-push-control-panel,
.kb-push-filter-row,
.kb-push-queue-panel {
  padding: 16px;
}

.kb-push-queue-list {
  display: grid;
  gap: 10px;
}

.kb-push-queue-list article {
  min-height: 64px;
  border: 1px solid #e6edf5;
  border-radius: 10px;
  background: #f8fbff;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.kb-push-queue-list article > span {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: #2563eb;
  background: #eaf2ff;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 400;
}

.kb-push-queue-list strong,
.kb-push-queue-list small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-push-queue-list strong {
  color: #203047;
  font-size: 14px;
  font-weight: 400;
}

.kb-push-queue-list small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.kb-push-user-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.kb-push-user-list span {
  min-height: 30px;
  border-radius: 9px;
  color: #334155;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
}

.kb-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kb-stats-grid article {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035);
}

.kb-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  font-weight: 400;
}

.kb-stat-icon.blue {
  color: #1d4ed8;
  background: #eaf2ff;
}

.kb-stat-icon.green {
  color: #059669;
  background: #e8fbf2;
}

.kb-stat-icon.orange {
  color: #d97706;
  background: #fff4df;
}

.kb-stat-icon.red {
  color: #dc2626;
  background: #fff1f2;
}

.kb-stat-icon.slate {
  color: #475569;
  background: #eef4fb;
}

.kb-stats-grid small {
  color: var(--muted);
  font-size: 12px;
}

.kb-stat-label-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kb-info-tip {
  position: relative;
  width: 16px;
  height: 16px;
  border: 1px solid #c7d8ee;
  border-radius: 999px;
  color: #2563eb;
  background: #f8fbff;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  cursor: help;
}

.kb-info-tip::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 20;
  width: 238px;
  border: 1px solid #d7e3f2;
  border-radius: 8px;
  color: #334155;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.kb-info-tip:hover::after,
.kb-info-tip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.kb-stats-grid strong {
  display: block;
  margin-top: 4px;
  color: #071a33;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}

.kb-console-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 256px);
}

.kb-console-side {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

.kb-side-card,
.kb-document-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 32, 51, 0.04);
}

.kb-upload-form {
  display: grid;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.kb-upload-form input[type="file"] {
  display: none;
}

.kb-upload-dropzone {
  min-height: 126px;
  border: 1px dashed #bfd1e6;
  border-radius: 10px;
  color: #64748b;
  background: #ffffff;
  display: grid;
  place-items: center;
  gap: 6px;
  margin: 0;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.kb-upload-dropzone:hover,
.kb-upload-dropzone.drag-over {
  border-color: #60a5fa;
  background: #f8fbff;
  transform: translateY(-1px);
}

.kb-upload-symbol {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #2563eb;
  background: #eaf2ff;
  display: inline-grid;
  place-items: center;
}

.kb-upload-symbol svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kb-upload-dropzone strong {
  color: #334155;
  font-size: 14px;
  font-weight: 400;
}

.kb-upload-dropzone small {
  color: #94a3b8;
  font-size: 12px;
}

.kb-upload-form button,
.kb-document-toolbar button {
  font-weight: 400;
}

.kb-document-toolbar button {
  min-height: 34px;
  border-radius: 9px;
  background: #0b63d8;
  box-shadow: 0 8px 18px rgba(11, 99, 216, 0.2);
  color: #ffffff;
  padding: 0 13px;
  font-size: 13px;
}

.kb-document-toolbar button:hover {
  background: #0b63d8;
  transform: none;
  filter: none;
}

.kb-manage-actions {
  display: grid;
  grid-template-columns: minmax(96px, 1.25fr) minmax(68px, 0.9fr) minmax(58px, 0.8fr);
  gap: 8px;
}

.kb-manage-actions button {
  min-width: 0;
  gap: 8px;
  min-height: 40px;
  padding: 8px;
  white-space: nowrap;
  line-height: 1.2;
  font-size: 13px;
  font-weight: 500;
}

.danger-text {
  color: #dc2626;
}

.kb-side-card {
  padding: 14px;
}

.kb-side-card > strong,
.kb-side-card-head span {
  color: #26384d;
  font-size: 14px;
  font-weight: 400;
}

.kb-side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kb-mini-icon-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid #d8e5f4;
  border-radius: 8px;
  color: #2563eb;
  background: #ffffff;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.kb-mini-icon-btn:hover {
  border-color: #93c5fd;
  background: #eaf2ff;
  transform: none;
  filter: none;
}

.kb-category-list {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.kb-category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
}

.kb-category-row.active {
  background: #eaf2ff;
}

.kb-side-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.kb-side-tag-list button {
  min-height: 28px;
  border: 1px solid #d8e5f4;
  border-radius: 999px;
  color: #2563eb;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 400;
}

.kb-side-tag-list button:hover {
  border-color: #93c5fd;
  background: #eaf2ff;
  transform: none;
  filter: none;
}

.kb-side-tag-list em {
  color: #64748b;
  font-style: normal;
  font-size: 11px;
}

.kb-side-tag-empty {
  color: var(--muted);
  font-size: 12px;
}

.kb-category-main {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #334155;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-weight: 400;
  font-size: 13px;
}

.kb-category-main:hover,
.kb-category-row.active .kb-category-main {
  color: #0b63d8;
  background: #eaf2ff;
  transform: none;
  filter: none;
}

.kb-category-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-right: 5px;
}

.kb-category-action {
  width: 25px;
  height: 25px;
  min-height: 25px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #64748b;
  background: transparent;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.kb-category-action:hover {
  border-color: #d8e5f4;
  color: #2563eb;
  background: #ffffff;
  transform: none;
  filter: none;
}

.kb-category-action.danger-text:hover {
  color: #dc2626;
  background: #fff1f2;
}

.kb-category-list em {
  color: #0b63d8;
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
}

.kb-upload-result {
  max-height: 180px;
  margin-top: 0;
  overflow: auto;
  font-size: 12px;
}

.kb-document-panel {
  min-width: 0;
  min-height: calc(100vh - 256px);
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.kb-document-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.kb-document-search {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.kb-document-search span {
  color: #64748b;
  font-size: 18px;
}

.kb-document-search input {
  min-width: 0;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  padding: 0;
}

.kb-file-table {
  min-width: 0;
  flex: 1;
  overflow: auto;
  border: 1px solid #e6edf5;
  border-radius: 10px;
}

.kb-file-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) 82px 96px 126px minmax(150px, 0.8fr) 110px 150px 76px;
  align-items: center;
  min-width: 1160px;
  min-height: 52px;
  border-bottom: 1px solid #e6edf5;
}

.kb-file-row.head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 48px;
  color: #5e6f86;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 400;
}

.kb-file-row > span {
  min-width: 0;
  padding: 0 14px;
  color: #334155;
  font-size: 13px;
  font-weight: 400;
}

.kb-file-row:not(.head):hover {
  background: #f8fbff;
}

.kb-file-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-file-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #2563eb;
  background: #eaf2ff;
  display: inline-grid;
  place-items: center;
  font-style: normal;
  font-weight: 400;
}

.kb-file-title,
.kb-file-name-cell small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-file-title {
  color: #334155;
  font-size: 13px;
  font-weight: 400;
}

.kb-file-name-cell small {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 12px;
}

.kb-file-actions-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.kb-file-delete-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: #8a9bb0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.kb-file-delete-btn:hover {
  color: #dc2626;
  background: #fff1f2;
  filter: none;
  transform: none;
}

.kb-file-delete-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kb-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-style: normal;
  color: #059669;
  background: #e8fbf2;
  font-size: 12px;
  font-weight: 400;
}

.kb-status-pill.processing {
  color: #d97706;
  background: #fff4df;
}

.kb-status-pill.failed {
  color: #dc2626;
  background: #fff1f2;
}

.kb-status-pill.archived {
  color: #475569;
  background: #eef4fb;
}

.kb-tags-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.kb-tags-cell i,
.kb-tags-cell em {
  flex: 0 1 auto;
  max-width: 86px;
  min-height: 24px;
  border-radius: 999px;
  color: #2563eb;
  background: #eaf2ff;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
}

.kb-tags-cell em {
  color: #64748b;
  background: #f1f5f9;
}

.kb-table-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.upload-page :where(h1, h2, h3, strong, b, button, .kb-file-title, .kb-file-row.head, .kb-status-pill, .kb-tags-cell i, .kb-tags-cell em, .kb-category-main, .kb-category-action, .kb-side-card-head span, .kb-workbench-tabs button, .kb-section-title strong, .kb-graph-legend strong, .kb-push-control-panel strong, .kb-push-filter-row > strong, .kb-graph-aside strong, .kb-security-side strong, .kb-push-side strong) {
  font-weight: 400 !important;
}

.upload-page :where(h1, h2, h3, strong, b, .kb-file-title, .kb-file-row.head, .kb-category-main span, .kb-side-card-head span) {
  color: #334155;
}

.kb-upload-dialog {
  width: min(900px, calc(100vw - 48px));
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 24px 26px;
}

.kb-upload-dialog .modal-header {
  align-items: flex-start;
}

.kb-upload-dialog .modal-header h2 {
  color: #152238;
  font-size: 24px;
}

.kb-upload-dialog .modal-header p {
  margin-top: 8px;
  color: #5f6f85;
  font-size: 15px;
  line-height: 1.5;
}

.kb-upload-dialog-label {
  display: block;
  margin-bottom: 10px;
  color: #334155;
  font-size: 16px;
  font-weight: 500;
}

.kb-pending-file-list {
  display: grid;
  gap: 8px;
}

.kb-pending-file-list div {
  min-height: 46px;
  border: 1px solid #dbe6f3;
  border-radius: 12px;
  background: #f8fbff;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.kb-pending-file-list span {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #2563eb;
  background: #eaf2ff;
  display: inline-grid;
  place-items: center;
  font-weight: 500;
}

.kb-pending-file-list strong {
  min-width: 0;
  overflow: hidden;
  color: #27364d;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 500;
}

.kb-pending-file-list em {
  color: #64748b;
  font-style: normal;
  font-size: 13px;
}

.kb-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kb-choice-list button {
  min-height: 38px;
  border: 1px solid #d8e5f4;
  border-radius: 999px;
  color: #334155;
  background: #ffffff;
  padding: 0 17px;
  font-size: 15px;
  font-weight: 500;
}

.kb-choice-list button:hover,
.kb-choice-list button.active {
  border-color: #93c5fd;
  color: #0b63d8;
  background: #eaf2ff;
  transform: none;
  filter: none;
}

.kb-choice-list button.kb-choice-add {
  border-style: dashed;
  color: #2563eb;
  background: #f8fbff;
}

.kb-choice-list button.kb-choice-add:hover {
  border-color: #60a5fa;
  background: #eaf2ff;
}

.kb-custom-tag {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.kb-custom-tag input {
  margin: 0;
  min-height: 50px;
  background: #ffffff;
}

.kb-custom-tag button {
  min-width: 74px;
  min-height: 50px;
}

.compact-result {
  min-height: 80px;
}

.login-page {
  min-height: 100vh;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(430px, 100%);
  background: color-mix(in oklab, var(--card) 92%, white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 14px 34px rgba(25, 34, 45, 0.1);
}

.auth-panel h1 {
  font-size: 32px;
  margin-bottom: 18px;
}

.auth-form,
.admin-form {
  display: grid;
  gap: 12px;
}

.form-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}

.admin-role-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.role-editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.role-editor-actions select,
.inline-role-select {
  width: auto;
  min-width: 128px;
  margin-top: 0;
}

.permission-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.permission-grid section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
}

.permission-grid section > strong {
  display: block;
  color: #102033;
  font-size: 15px;
  margin-bottom: 10px;
}

.permission-grid section > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-check {
  min-height: 34px;
  border: 1px solid #d8e5f4;
  border-radius: 999px;
  color: #334155;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  font-weight: 500;
  cursor: pointer;
}

.permission-check input {
  width: auto;
  margin: 0;
}

.permission-check:has(input:checked) {
  border-color: #93c5fd;
  color: #0b63d8;
  background: #eaf2ff;
}

.table-scroll {
  margin-top: 12px;
  overflow: auto;
}

.admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  font-size: 14px;
}

.admin-table th {
  background: var(--panel-2);
}

.system-page {
  min-height: 100vh;
  background: #f6f8fb;
}

.system-shell {
  min-height: 100vh;
}

.system-shell > .top-app-nav {
  width: 100%;
  margin: 0;
}

.system-management-page {
  min-height: calc(100vh - 68px);
  background: #f6f8fb;
  color: #0b1f3a;
}

.system-management-topbar {
  min-height: 58px;
  border-bottom: 1px solid #e5ebf3;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
}

.system-management-topbar > strong {
  padding-right: 22px;
  border-right: 1px solid #d9e3f0;
  color: #102033;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.system-management-topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.system-management-topbar nav button {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4f6075;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.system-management-topbar nav button:hover {
  color: #0b63d8;
  background: #eef5ff;
}

.system-management-topbar nav button.active {
  color: #ffffff;
  background: #0b63d8;
  box-shadow: 0 8px 18px rgba(11, 99, 216, 0.2);
}

.system-tab-panel {
  padding: 24px 32px 36px;
}

.system-tab-panel[hidden] {
  display: none !important;
}

.system-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

.system-section-head h2 {
  color: #26384d;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.25;
}

.system-section-head p {
  margin-top: 0;
  color: #5c6f87;
  font-size: 13px;
}

.system-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.system-light-button,
.system-primary-button {
  min-height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 400;
}

.system-light-button {
  border: 1px solid #bfdbfe;
  color: #0b63d8;
  background: #eaf2ff;
}

.system-light-button:hover {
  color: #0756bd;
  border-color: #93c5fd;
  background: #dbeafe;
}

.system-primary-button {
  border: 1px solid #bfdbfe;
  color: #0b63d8;
  background: #eaf2ff;
  box-shadow: none;
}

.system-add-user-button {
  color: #0b63d8;
  border: 1px solid #bfdbfe;
  background: #eaf2ff;
  box-shadow: none;
}

.system-add-experience-button {
  color: #0b63d8;
  border: 1px solid #bfdbfe;
  background: #eaf2ff;
  box-shadow: none;
}

.system-add-role-button {
  border: 1px solid #bfdbfe;
  color: #0b63d8;
  background: #eaf2ff;
  box-shadow: none;
}

.system-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.system-stat-grid.three {
  grid-template-columns: repeat(3, minmax(200px, 1fr));
}

.system-stat-card {
  min-height: 92px;
  border: 1px solid #e3eaf3;
  border-radius: 16px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(10, 35, 70, 0.04);
}

.system-stat-card span {
  color: #667990;
  font-size: 13px;
}

.system-stat-card strong {
  display: block;
  margin-top: 12px;
  color: #071a33;
  font-size: 28px;
  line-height: 1;
  font-weight: 400;
}

.system-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
}

.system-stat-icon.blue {
  color: #0b63d8;
  background: #eaf2ff;
}

.system-stat-icon.green {
  color: #10b981;
  background: #e9fbf3;
}

.system-stat-icon.amber {
  color: #f59e0b;
  background: #fff5df;
}

.system-stat-icon.orange {
  color: #f97316;
  background: #fff1e7;
}

.system-user-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 16px;
}

.system-user-search,
.system-search-field {
  height: 42px;
  border: 1px solid #dce6f2;
  border-radius: 10px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: #8ca0b7;
  font-size: 14px;
}

.system-user-search {
  width: min(380px, 100%);
}

.system-search-field {
  width: 100%;
}

.system-user-search input,
.system-search-field input {
  min-width: 0;
  flex: 1;
  width: auto;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: none;
  padding: 0;
  color: #102033;
  font: inherit;
}

.system-user-search:focus-within,
.system-search-field:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.16);
}

.system-search-count {
  border-radius: 999px;
  background: #eaf2ff;
  color: #0b63d8;
  padding: 4px 9px;
  font-size: 12px;
}

.system-message {
  margin-bottom: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #0b63d8;
  padding: 10px 14px;
}

.system-message.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #dc2626;
}

.system-table-card {
  overflow-x: auto;
  border: 1px solid #e3eaf3;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(10, 35, 70, 0.04);
}

.system-user-row {
  min-width: 1060px;
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(250px, 1.35fr) 150px 150px 120px 190px 170px 150px;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-top: 1px solid #edf2f8;
  color: #344961;
  font-size: 14px;
}

.system-user-head {
  min-height: 54px;
  border-top: 0;
  background: #fbfdff;
  color: #5c6f87;
}

.system-user-head > :nth-child(1) {
  padding-left: 46px;
}

.system-head-filter,
.system-head-sort {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.system-head-filter > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-head-filter-control {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.system-head-filter-button,
.system-head-sort button {
  border: 0;
  color: #52637a;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transform: none;
  filter: none;
}

.system-head-filter-button {
  width: 18px;
  height: 18px;
  min-height: 18px;
  border-radius: 4px;
}

.system-head-filter-button::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.25px solid currentColor;
  border-bottom: 1.25px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.system-head-filter-button:hover,
.system-head-filter-button:focus,
.system-head-filter.active .system-head-filter-button,
.system-head-sort button:hover,
.system-head-sort button:focus,
.system-head-sort button.active {
  color: #2563eb;
  background: #eff6ff;
  transform: none;
  filter: none;
}

.system-head-sort button {
  min-height: 24px;
  border-radius: 6px;
  gap: 5px;
  padding: 0 6px;
}

.system-head-sort button span {
  color: inherit;
  font-size: 13px;
  line-height: 1;
}

.system-head-filter-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 40;
  display: none;
  width: max-content;
  min-width: 120px;
  max-width: 190px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #d8e5f4;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
  padding: 6px;
  text-align: left;
  transform: translateX(-50%);
}

.system-head-filter-menu.open {
  display: grid;
  gap: 2px;
}

.system-head-filter-menu button {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  color: #334155;
  background: #ffffff;
  display: block;
  margin: 0;
  padding: 0 10px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 400;
  transform: none;
  filter: none;
}

.system-head-filter-menu button:hover,
.system-head-filter-menu button:focus {
  color: #2563eb;
  background: #eff6ff;
  transform: none;
  filter: none;
}

.system-head-filter-menu button.active {
  color: #1d4ed8;
  background: #eaf2ff;
}

.system-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.system-user-info b {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 400;
}

.system-user-info span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.system-user-info strong {
  overflow: hidden;
  color: #102033;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-user-info small {
  overflow: hidden;
  color: #93a2b5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-role-chip,
.system-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-style: normal;
  font-size: 12px;
  white-space: nowrap;
}

.system-role-chip {
  color: #0b63d8;
  background: #eaf2ff;
}

.system-role-chip.admin {
  color: #b45309;
  background: #fef3c7;
}

.system-role-chip.muted {
  color: #64748b;
  background: #f1f5f9;
}

.system-status-chip.active {
  color: #059669;
  background: #dcfce7;
}

.system-status-chip.pending {
  color: #d97706;
  background: #fff7ed;
}

.system-status-chip.disabled {
  color: #64748b;
  background: #f1f5f9;
}

.system-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.system-row-icon-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  color: #8a9bb0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.system-row-icon-button:hover {
  color: #0b63d8;
  background: #eaf2ff;
  transform: none;
  filter: none;
}

.system-row-icon-button.danger {
  color: #8a9bb0;
}

.system-row-icon-button.danger:hover {
  color: #dc2626;
  background: #fff1f2;
}

.system-row-icon-button:disabled {
  color: #cbd5e1;
  background: transparent;
  cursor: not-allowed;
}

.system-row-icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.system-row-actions .inline-role-select {
  width: 138px;
  min-width: 138px;
}

.system-empty-row {
  padding: 26px;
  color: #7a8ca4;
  text-align: center;
}

.system-running {
  display: inline-flex;
  align-items: center;
  color: #8a9bb0;
  font-size: 13px;
}

.system-running b {
  color: #10b981;
  font-weight: 400;
}

.system-placeholder-card {
  min-height: 320px;
  border: 1px solid #e3eaf3;
  border-radius: 16px;
  background: #ffffff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  color: #7a8ca4;
}

.system-placeholder-card h3 {
  margin: 0;
  color: #102033;
  font-size: 20px;
  font-weight: 400;
}

.system-placeholder-card p {
  margin: 0;
}

.system-role-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.system-role-list-card,
.system-role-detail-card,
.system-permission-group,
.system-role-members,
.system-log-card {
  border: 1px solid #e3eaf3;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(10, 35, 70, 0.04);
}

.system-role-list-card {
  padding: 16px;
  position: sticky;
  top: 72px;
}

.system-role-card-head,
.system-role-detail-head,
.system-permission-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.system-role-card-head {
  align-items: center;
}

.system-role-card-head .system-add-role-button {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
}

.system-role-card-head strong,
.system-role-detail-head h3,
.system-permission-group-head strong {
  display: block;
  color: #26384d;
  font-weight: 400;
}

.system-role-card-head strong,
.system-permission-group-head strong {
  font-size: 14px;
}

.system-role-card-head span,
.system-role-detail-head span,
.system-permission-group-head small {
  color: #7a8ca4;
  font-size: 13px;
}

.system-role-search {
  margin: 14px 0;
}

.system-role-list {
  display: grid;
  gap: 10px;
}

.system-role-list-item {
  width: 100%;
  border: 1px solid #e7eef7;
  border-radius: 12px;
  background: #ffffff;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: #344961;
  text-align: left;
}

.system-role-list-item:hover,
.system-role-list-item.active {
  border-color: #bfdbfe;
  background: #f5f9ff;
  transform: none;
  filter: none;
}

.system-role-list-item b,
.system-role-member b {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #0b63d8;
  background: #eaf2ff;
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 400;
}

.system-role-list-item span,
.system-role-member span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.system-role-list-item strong,
.system-role-member strong {
  overflow: hidden;
  color: #344961;
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-role-list-item small,
.system-role-member small {
  overflow: hidden;
  color: #7a8ca4;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-role-list-item i {
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  padding: 4px 8px;
  font-size: 12px;
  font-style: normal;
}

.system-role-list-item.active i {
  color: #0b63d8;
  background: #eaf2ff;
}

.system-role-detail-card {
  padding: 18px;
}

.system-role-detail-head {
  padding-bottom: 16px;
  border-bottom: 1px solid #edf2f8;
}

.system-role-detail-head h3 {
  margin: 6px 0;
  font-size: 15px;
}

.system-role-detail-head p {
  margin: 0;
  color: #5c6f87;
  font-size: 13px;
}

.system-role-tools {
  display: flex;
  gap: 8px;
}

.system-role-tools button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  color: #8a9bb0;
  background: #f1f5f9;
  display: grid;
  place-items: center;
  padding: 0;
}

.system-role-tools button:hover {
  color: #dc2626;
  background: #fff1f2;
  transform: none;
  filter: none;
}

.system-role-tools button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.system-role-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(280px, 1fr);
  gap: 14px;
  margin: 16px 0;
}

.system-role-edit-grid label,
.system-dialog-grid label {
  display: grid;
  gap: 8px;
  color: #4f6075;
  font-size: 13px;
}

.system-role-edit-grid input,
.system-dialog-grid input,
.system-dialog-grid select,
.system-dialog-grid textarea {
  min-height: 40px;
  margin: 0;
  border: 1px solid #dce6f2;
  border-radius: 10px;
  background: #ffffff;
  color: #102033;
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.system-dialog-grid textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

.system-dialog-full {
  grid-column: 1 / -1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.system-role-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.system-role-summary-strip article {
  border: 1px solid #edf2f8;
  border-radius: 12px;
  background: #fbfdff;
  padding: 14px;
}

.system-role-summary-strip span {
  color: #7a8ca4;
  font-size: 12px;
}

.system-role-summary-strip strong {
  display: block;
  margin-top: 8px;
  color: #0b63d8;
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
}

.system-permission-groups {
  display: grid;
  gap: 14px;
}

.system-permission-group {
  padding: 16px;
}

.system-permission-group-head span {
  border-radius: 999px;
  color: #0b63d8;
  background: #eaf2ff;
  padding: 4px 9px;
  font-size: 12px;
}

.system-permission-group-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.system-permission-group-actions button {
  min-height: 30px;
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: #ffffff;
  color: #4f6075;
  padding: 0 10px;
}

.system-permission-group-actions button:hover {
  color: #0b63d8;
  border-color: #bfdbfe;
  background: #f5f9ff;
  transform: none;
  filter: none;
}

.system-permission-group-actions button:disabled {
  color: #a8b5c6;
  cursor: not-allowed;
}

.system-permission-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.system-permission-item {
  min-height: 40px;
  border: 1px solid #e3eaf3;
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: #344961;
  font-size: 13px;
  cursor: pointer;
}

.system-permission-item.active {
  border-color: #bfdbfe;
  color: #0b63d8;
  background: #eff6ff;
}

.system-permission-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #0b63d8;
}

.system-role-members {
  margin-top: 16px;
  padding: 16px;
}

.system-role-member-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.system-role-member {
  min-height: 52px;
  border-top: 1px solid #edf2f8;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
}

.system-role-member:first-child {
  border-top: 0;
  padding-top: 0;
}

.system-role-member em {
  border-radius: 999px;
  color: #059669;
  background: #dcfce7;
  padding: 4px 9px;
  font-size: 12px;
  font-style: normal;
}

.system-log-card {
  width: min(760px, 100%);
  overflow: hidden;
}

.system-log-row {
  min-height: 56px;
  border-top: 1px solid #edf2f8;
  display: grid;
  grid-template-columns: 34px 1fr 76px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.system-log-row:first-child {
  border-top: 0;
}

.system-log-row b {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #0b63d8;
  background: #eaf2ff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 400;
}

.system-log-row span {
  display: grid;
  gap: 4px;
}

.system-log-row strong {
  color: #344961;
  font-size: 13px;
  font-weight: 400;
}

.system-log-row small,
.system-log-row em {
  color: #7a8ca4;
  font-size: 12px;
  font-style: normal;
}

.system-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.34);
  display: grid;
  place-items: center;
  padding: 24px;
}

.system-modal-backdrop[hidden] {
  display: none !important;
}

.system-user-dialog {
  width: min(680px, 100%);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
  padding: 22px;
}

.system-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.system-dialog-head h3 {
  margin: 0;
  color: #102033;
  font-size: 20px;
  font-weight: 400;
}

.system-dialog-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  color: #64748b;
  background: #f1f5f9;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
}

.system-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.system-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e8eef6;
}

.system-dialog-actions button {
  min-width: 128px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #d9e4f2;
  color: #344961;
  background: #ffffff;
}

.system-dialog-actions button:last-child {
  border-color: #dbeafe;
  color: #ffffff;
  background: #0b63d8;
}

.system-page :where(h1, h2, h3, strong, b, button, .system-user-head, .system-role-chip, .system-status-chip) {
  font-weight: 400;
}

.chat-page {
  height: 100vh;
  overflow: hidden;
}

.chat-shell {
  height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-module-header {
  min-height: 104px;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.chat-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px 1fr;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.chat-shell.sidebar-collapsed .chat-layout {
  grid-template-columns: 1fr;
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-shell.sidebar-collapsed .chat-sidebar {
  display: none;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-top h2 {
  margin: 0;
  color: #26384d;
  font-size: 16px;
  font-weight: 400;
}

.sidebar-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#newChatBtn {
  background: var(--accent);
  font-size: 13px;
  font-weight: 400;
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

.chat-icon-button,
.chat-sidebar-restore {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #2563eb;
  background: #eff6ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chat-icon-button:hover,
.chat-sidebar-restore:hover {
  background: #dbeafe;
  filter: none;
  transform: none;
}

.chat-icon-button svg,
.chat-sidebar-restore svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-sidebar-restore {
  display: none;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.chat-shell.sidebar-collapsed .chat-sidebar-restore {
  display: inline-flex;
}

.session-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-panel h3 {
  color: #26384d;
  font-size: 14px;
  font-weight: 400;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 4px;
}

.session-item {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  padding: 10px;
}

.session-item.active {
  border-color: var(--accent);
  background: var(--panel-2);
}

.session-title {
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chat-main {
  position: relative;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-main-tools {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 28px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.chat-main-tools .chat-icon-button {
  background: rgba(239, 246, 255, 0.94);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.chat-main-tools .chat-sidebar-restore {
  pointer-events: auto;
}

.chat-main-tools #toggleChatFullscreenBtn {
  margin-left: auto;
}

.chat-main-tools .icon-restore,
.chat-main-tools .active .icon-expand {
  display: none;
}

.chat-main-tools .active .icon-restore {
  display: block;
}

.chat-shell.chat-main-fullscreen {
  padding: 0;
}

.chat-shell.chat-main-fullscreen > .top-app-nav {
  display: none;
}

.chat-shell.chat-main-fullscreen .chat-layout {
  position: fixed;
  inset: 0;
  z-index: 1400;
  grid-template-columns: 1fr;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.chat-shell.chat-main-fullscreen .chat-sidebar,
.chat-shell.chat-main-fullscreen .chat-sidebar-restore {
  display: none;
}

.chat-shell.chat-main-fullscreen .chat-main {
  padding: 16px;
}

.chat-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.chat-main-header h2 {
  color: #26384d;
  font-size: 16px;
  font-weight: 400;
}

.session-label {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

.filter-label {
  margin-top: 6px;
  font-size: 13px;
  color: #1f7fd1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-block;
  max-width: min(70vw, 880px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#clearHistoryBtn {
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 13px;
  font-weight: 400;
  width: 100%;
  min-height: 36px;
}

.chat-messages {
  margin-top: 0;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  padding: 14px 20px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.chat-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  text-align: center;
  padding: 20px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #2563eb;
  background: #eaf2ff;
  border: 1px solid #dbeafe;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
}

.chat-avatar.user {
  color: #ffffff;
  background: #3b82f6;
  border-color: #3b82f6;
}

.bubble {
  width: fit-content;
  max-width: min(78%, 860px);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
  font-size: 13px;
  font-weight: 400;
}

.message.user .bubble {
  max-width: min(62%, 720px);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #fff;
  color: #1e3a8a;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.message.assistant .bubble {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding-left: 0;
  box-shadow: none;
}

.message.assistant .bubble > div:first-child {
  font-weight: 400;
}

.thinking-bubble {
  width: auto;
  min-width: 190px;
  color: #496176;
}

.thinking-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #60a5fa;
  opacity: 0.35;
  animation: thinkingPulse 1.1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes thinkingPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.bubble-time {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.message.user .bubble-time {
  color: #5b79b2;
}

.bubble-citations {
  margin: 10px 0 0;
  padding-left: 18px;
}

.bubble-previews {
  margin-top: 10px;
  background: var(--panel-2);
  border: 1px solid #d6e8f8;
  border-radius: 10px;
  padding: 8px 10px;
}

.bubble-previews-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.bubble-previews ul {
  margin: 0;
  padding-left: 18px;
}

.bubble-previews li {
  font-size: 13px;
  line-height: 1.5;
}

.table-wrap,
.chart-wrap {
  margin-top: 12px;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.table-wrap th,
.table-wrap td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
}

.table-wrap thead th {
  background: var(--panel-2);
}

.chart-wrap {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.chart-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.chat-composer {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.chat-composer textarea {
  margin-top: 0;
  min-height: 72px;
  resize: vertical;
  border-radius: 12px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 400;
}

.chat-composer textarea::placeholder {
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
}

.chat-composer button {
  font-size: 13px;
  font-weight: 400;
}

.chat-page .account-name,
.chat-page .secondary-btn {
  font-size: 13px;
  font-weight: 400;
}

.chat-page :where(h1, h2, h3, strong, b, button, .bubble, .bubble *, .message, .message *, .session-item, .session-item *) {
  font-weight: 400;
}

@media (max-width: 960px) {
  .page,
  .page.narrow,
  .module-page {
    width: min(100% - 28px, 1000px);
  }

  .upload-module-page {
    width: calc(100% - 20px);
  }

  .module-header {
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .top-app-nav {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }

  .top-app-brand {
    padding-right: 0;
    border-right: 0;
  }

  .top-module-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .top-module-nav a {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    white-space: nowrap;
  }

  .module-actions {
    justify-content: flex-start;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .workspace-panel {
    width: 100%;
    margin-top: 28px;
  }

  .workspace-item {
    min-height: 118px;
  }

  .kb-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kb-console-shell {
    grid-template-columns: 1fr;
  }

  .kb-feature-panel {
    grid-template-columns: 1fr;
  }

  .kb-graph-head,
  .kb-section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .kb-graph-search {
    width: 100%;
  }

  .kb-graph-metrics {
    grid-template-columns: 1fr;
  }

  .kb-bulk-permission-head,
  .kb-bulk-permission-controls {
    grid-template-columns: 1fr;
  }

  .kb-bulk-permission-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .kb-bulk-permission-controls label {
    flex: none;
  }

  .kb-bulk-permission-head {
    align-items: stretch;
    flex-direction: column;
  }

  .kb-bulk-permission-checks {
    padding-bottom: 0;
  }

  .kb-document-panel {
    min-height: 520px;
  }

  .kb-document-toolbar {
    grid-template-columns: 1fr;
  }

  .kb-manage-actions {
    grid-template-columns: 1fr;
  }

  .kb-manage-actions button {
    white-space: normal;
  }

  .kb-upload-dialog {
    width: calc(100vw - 24px);
    padding: 18px;
  }

  .kb-custom-tag {
    grid-template-columns: 1fr;
  }

  .chat-shell {
    padding: 10px;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .chat-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 42vh;
  }

  .chat-main {
    min-height: 0;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .page-hero,
  .admin-hero,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-bar,
  .top-actions {
    justify-content: flex-start;
  }

  .admin-grid,
  .admin-role-grid {
    grid-template-columns: 1fr;
  }

  .system-management-topbar,
  .system-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .system-management-topbar {
    padding: 12px 16px;
  }

  .system-management-topbar > strong {
    padding-right: 0;
    border-right: 0;
  }

  .system-tab-panel {
    padding: 18px 14px 28px;
  }

  .system-stat-grid,
  .system-stat-grid.three,
  .system-role-layout,
  .system-role-edit-grid,
  .system-role-summary-strip,
  .system-dialog-grid {
    grid-template-columns: 1fr;
  }

  .system-actions {
    justify-content: flex-start;
  }

  .system-role-list-card {
    position: static;
  }

  .file-picker {
    flex-direction: column;
    align-items: stretch;
  }

  .file-status {
    white-space: normal;
  }
}
