:root {
  --bg: #f6f8f5;
  --bg-2: #edf4f1;
  --panel: #ffffff;
  --panel-soft: #f8fbf8;
  --ink: #17211f;
  --muted: #697a75;
  --line: #dfe8e3;
  --line-strong: #c9d8d1;
  --primary: #157f72;
  --primary-strong: #0e655b;
  --primary-soft: #e5f4f0;
  --accent: #b8812d;
  --danger: #c64747;
  --shadow-sm: 0 8px 22px rgba(25, 48, 42, 0.07);
  --shadow-md: 0 18px 44px rgba(25, 48, 42, 0.12);
}

/* Figma redesign pass: operational dashboard structure and mobile-first data cards. */
.ops-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.ops-metric {
  position: relative;
  min-height: 116px;
  padding: 16px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(21, 127, 114, 0.08), transparent 60%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.ops-metric-icon {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  right: 14px;
  top: 16px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 -10px 18px rgba(21, 127, 114, 0.14);
}

.ops-metric.urgent {
  background:
    linear-gradient(135deg, rgba(198, 71, 71, 0.09), transparent 62%),
    var(--panel);
  border-color: #edc7c7;
}

.ops-metric.urgent .ops-metric-icon {
  color: var(--danger);
  background: #ffe8e8;
}

.ops-metric-label {
  display: block;
  max-width: calc(100% - 48px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.ops-metric strong {
  display: block;
  margin-top: 16px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.ops-metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-panel .card-header,
.data-workspace-card .card-header,
.tool-panel-card .card-header {
  background:
    linear-gradient(90deg, rgba(229, 244, 240, 0.9), rgba(255, 255, 255, 0.95));
}

.filter-panel .card-header strong,
.data-workspace-card .card-header strong,
.tool-panel-card .card-header strong {
  font-size: 15px;
}

.filter-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.data-workspace-card {
  border-color: #d5e3dd;
}

.data-workspace-card .table-responsive {
  max-height: calc(100vh - 380px);
  min-height: 320px;
}

.data-workspace-card .table tbody tr {
  transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.data-workspace-card .table tbody tr:hover {
  box-shadow: inset 3px 0 0 var(--primary);
}

.mobile-primary-cell {
  color: var(--ink);
  font-weight: 750;
}

.mobile-full {
  display: none;
}

.batch-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 1199.98px) {
  .ops-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  body {
    padding-bottom: 78px;
    background: var(--bg);
  }

  .content {
    padding: 0;
  }

  .page-surface {
    margin-top: 12px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: 96px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: 0 10px 26px rgba(25, 48, 42, 0.1);
  }

  .topbar-title {
    align-items: flex-start;
  }

  .topbar-user {
    width: 100%;
  }

  .page-kicker {
    max-width: 260px;
    line-height: 1.35;
  }

  .layout {
    min-height: auto;
  }

  .mobile-tabbar {
    position: fixed;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 1090;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 46px rgba(25, 48, 42, 0.2);
    backdrop-filter: blur(16px);
  }

  .mobile-tabbar a {
    display: grid;
    justify-items: center;
    gap: 3px;
    min-width: 0;
    padding: 6px 4px;
    color: var(--muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-tabbar a.active {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .mobile-tabbar i {
    font-size: 17px;
    line-height: 1;
  }

  .ops-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 0 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .ops-metric {
    min-width: 112px;
    min-height: 98px;
    padding: 12px;
    scroll-snap-align: start;
  }

  .ops-metric-icon {
    width: 24px;
    height: 24px;
    right: 10px;
    top: 12px;
    font-size: 12px;
  }

  .ops-metric strong {
    margin-top: 14px;
    font-size: 22px;
  }

  .ops-metric small {
    margin-top: 8px;
    white-space: normal;
  }

  .filter-panel,
  .tool-panel-card,
  .data-workspace-card {
    margin-right: 12px;
    margin-left: 12px;
  }

  .filter-panel .card-header,
  .data-workspace-card .card-header,
  .tool-panel-card .card-header {
    display: grid !important;
    gap: 10px;
    align-items: start !important;
  }

  .filter-actions,
  .filter-panel .card-header > .d-flex,
  .data-workspace-card .card-header > .d-flex {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .filter-actions .btn,
  .filter-panel .card-header .btn {
    flex: 0 0 auto;
  }

  .monitor-filter-grid,
  .users-filter-grid {
    grid-template-columns: 1fr;
  }

  .monitor-date-range {
    grid-template-columns: 1fr;
  }

  .monitor-date-range span {
    display: none;
  }

  .data-workspace-card .table-responsive {
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .data-workspace-card table,
  .data-workspace-card thead,
  .data-workspace-card tbody,
  .data-workspace-card th,
  .data-workspace-card td,
  .data-workspace-card tr {
    display: block;
  }

  .data-workspace-card table {
    min-width: 0 !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  .data-workspace-card thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-workspace-card tbody {
    display: grid;
    gap: 12px;
    padding: 12px;
    background: #f4f8f6;
  }

  .data-workspace-card tbody tr {
    position: relative;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
  }

  .data-workspace-card tbody tr:hover {
    box-shadow: var(--shadow-sm);
  }

  .data-workspace-card td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    width: auto !important;
    max-width: none !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid #eef3f0;
    font-size: 13px !important;
  }

  .data-workspace-card td:last-child {
    border-bottom: 0;
  }

  .data-workspace-card td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
  }

  .data-workspace-card td.mobile-primary-cell {
    display: block;
    width: auto !important;
    padding-top: 2px !important;
  }

  .data-workspace-card td.mobile-primary-cell::before {
    display: block;
    margin-bottom: 6px;
  }

  .data-workspace-card td[data-label="选择"] {
    position: absolute;
    top: 10px;
    right: 12px;
    display: block;
    padding: 0 !important;
    border-bottom: 0;
  }

  .data-workspace-card td[data-label="选择"]::before {
    display: none;
  }

  .data-workspace-card td[data-label="操作"] {
    display: block;
    padding-top: 10px !important;
  }

  .data-workspace-card td[data-label="操作"]::before {
    display: block;
    margin-bottom: 8px;
  }

  .data-workspace-card td[data-label="操作"] .btn,
  .qa-actions .btn,
  .users-actions .btn {
    min-height: 36px;
  }

  .qa-actions,
  .users-actions,
  .data-workspace-card td[data-label="操作"] .d-flex {
    gap: 8px;
    flex-wrap: wrap;
  }

  .batch-action-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .batch-action-bar .form-select,
  .batch-action-bar .btn {
    width: 100%;
    max-width: none !important;
  }

  .users-ellipsis {
    max-width: 100%;
    white-space: normal;
    word-break: break-all;
  }

  .app-footer {
    padding-bottom: 18px;
  }

  .desktop-preview {
    display: none;
  }

  .mobile-full {
    display: block;
  }

  .monitor-table td[data-label="ID"],
  .monitor-table td[data-label="提问用户"],
  .monitor-table td[data-label="答案"],
  .monitor-table td[data-label="状态"],
  .monitor-table td[data-label="命中RAG"],
  .monitor-table td[data-label="推送状态"],
  .monitor-table td[data-label="人工回复"] {
    display: none !important;
  }

  .qa-list-table td[data-label="分类"],
  .qa-list-table td[data-label="答案预览"],
  .qa-list-table td[data-label="推送状态"] {
    display: none !important;
  }

  .monitor-table td[data-label="提问时间"],
  .qa-list-table td[data-label="ID"] {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    color: var(--muted);
    font-size: 12px !important;
    font-weight: 800;
  }

  .monitor-table td[data-label="提问时间"]::before,
  .qa-list-table td[data-label="ID"]::before {
    display: inline;
    margin: 0;
  }

  .monitor-table td[data-label="问题"],
  .qa-list-table td[data-label="问题"] {
    margin-top: 8px;
    color: var(--ink);
    font-size: 16px !important;
    font-weight: 900;
    line-height: 1.45;
    word-break: break-word;
  }

  .monitor-table td[data-label="问题"]::before,
  .qa-list-table td[data-label="问题"]::before {
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
  }

  .monitor-table td[data-label="操作"],
  .qa-list-table td[data-label="操作"] {
    margin-top: 10px;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(21, 127, 114, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(184, 129, 45, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-strong);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

body.sidebar-collapsed .layout {
  grid-template-columns: 88px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  padding: 18px 14px;
  overflow-y: auto;
  color: #f6fffb;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    #143b38;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.sidebar-top {
  position: relative;
  padding: 0 4px 16px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #123431;
  background: #dff5ec;
  box-shadow: inset 0 -8px 18px rgba(21, 127, 114, 0.16);
}

.brand-mark img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}

.brand-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.brand-title {
  display: block;
  color: #f6fffb;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
}

.sidebar-toggle {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.12);
}

.nav-link-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 4px;
  padding: 10px 12px;
  color: rgba(246, 255, 251, 0.78);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-link-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.nav-link-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

.nav-link-item.active {
  color: #123431;
  background: #e4f6ef;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.content {
  min-width: 0;
  padding: 0;
}

.content > section,
.topbar,
.app-footer {
  max-width: 1440px;
  margin-right: auto;
  margin-left: auto;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label {
  display: none;
}

body.sidebar-collapsed .sidebar {
  padding-right: 10px;
  padding-left: 10px;
}

body.sidebar-collapsed .sidebar-top {
  display: grid !important;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  padding-right: 0;
  padding-left: 0;
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle {
  width: 36px;
  height: 30px;
}

body.sidebar-collapsed .nav-link-item {
  justify-content: center;
  padding-right: 0;
  padding-left: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(211, 224, 218, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 850;
  line-height: 1.15;
}

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

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  color: #0e655b;
  background: var(--primary-soft);
  border: 1px solid #c7e6dc;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.user-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.page-surface {
  margin-top: 18px;
}

.app-footer {
  padding: 16px 4px 4px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.card-glass,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.card {
  overflow: hidden;
  font-size: 13px;
}

.card-header {
  min-height: 48px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
  border-bottom: 1px solid var(--line);
  color: #21312d;
  font-weight: 800;
}

.card-body {
  padding: 16px;
}

.card-footer {
  padding: 12px 16px;
  background: #fbfcfb;
  border-top: 1px solid var(--line);
}

.card-body h5,
.tool-block h6 {
  margin-bottom: 12px;
  color: #22312e;
  font-weight: 850;
}

.stat-card {
  min-height: 126px;
  border-color: #d7e5df;
  background:
    linear-gradient(135deg, rgba(21, 127, 114, 0.1), transparent 58%),
    #fff;
}

.stat-card .card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 126px;
}

.stat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #cce6de;
  border-radius: 8px;
  box-shadow: inset 0 -8px 16px rgba(21, 127, 114, 0.12);
}

.stat-icon.danger {
  color: var(--danger);
  background: #ffe8e8;
  border-color: #f0c6c6;
}

.stat-icon.gold {
  color: #8a5a12;
  background: #fff1cf;
  border-color: #edd197;
}

.stat-card .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card .value {
  margin-top: 10px;
  color: var(--primary-strong);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.quota-caption {
  margin-top: .45rem;
  color: var(--bs-secondary-color);
  font-size: .78rem;
  line-height: 1.3;
}

.quota-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(13, 110, 253, .18);
  border-radius: 14px;
  background: rgba(13, 110, 253, .055);
}

.quota-panel > div {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.quota-panel p {
  margin: 0;
  color: var(--bs-secondary-color);
  font-size: .88rem;
}

.quota-panel-exhausted {
  border-color: rgba(220, 53, 69, .25);
  background: rgba(220, 53, 69, .07);
}

@media (max-width: 767.98px) {
  .quota-panel,
  .quota-panel > div {
    align-items: flex-start;
    flex-direction: column;
  }
}

.stat-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.stat-link .stat-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.stat-link:hover .stat-card,
.stat-link:focus-visible .stat-card {
  transform: translateY(-3px);
  border-color: #a7cec3;
  box-shadow: var(--shadow-md);
}

.tool-block,
.user-manage-form {
  border-color: var(--line) !important;
  background: var(--panel-soft);
  border-radius: 8px !important;
}

.form-label {
  margin-bottom: 6px;
  color: #334743;
  font-size: 12px;
  font-weight: 800;
}

.form-control,
.form-select {
  min-height: 40px;
  color: var(--ink);
  background-color: #fff;
  border-color: #cfddd6;
  border-radius: 8px;
  font-size: 13px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(21, 127, 114, 0.14);
}

textarea.form-control {
  line-height: 1.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease, border-color 0.14s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

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

.btn i {
  font-size: 1em;
  line-height: 1;
}

.btn-sm {
  min-height: 32px;
  padding-right: 10px;
  padding-left: 10px;
  font-size: 12px;
}

.btn-primary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    var(--primary);
  border-color: var(--primary);
  box-shadow: 0 10px 22px rgba(21, 127, 114, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-strong);
  border-color: var(--primary-strong);
  box-shadow: 0 12px 24px rgba(14, 101, 91, 0.24);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: #9dcac0;
  background:
    linear-gradient(180deg, rgba(229, 244, 240, 0.45), rgba(255, 255, 255, 0.9));
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #fff;
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-secondary {
  color: #556964;
  border-color: #bdcbc5;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 247, 244, 0.9));
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: #23312e;
  background-color: #eef4f1;
  border-color: #aabbb4;
}

.btn-outline-danger {
  color: var(--danger);
  border-color: #e2b7b7;
  background:
    linear-gradient(180deg, rgba(255, 247, 247, 0.96), rgba(255, 255, 255, 0.9));
}

.btn-outline-success {
  color: #1e7a52;
  border-color: #acd6bf;
  background:
    linear-gradient(180deg, rgba(237, 248, 241, 0.96), rgba(255, 255, 255, 0.9));
}

.btn-outline-info {
  color: #286288;
  border-color: #b7d5e6;
  background:
    linear-gradient(180deg, rgba(235, 247, 255, 0.96), rgba(255, 255, 255, 0.9));
}

.table-responsive {
  scrollbar-width: thin;
}

.table {
  margin-bottom: 0;
  color: #24332f;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 10px;
  color: #52645f;
  background: #f3f7f5;
  border-bottom: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.table > :not(caption) > * > * {
  padding: 11px 10px;
  vertical-align: top;
  border-bottom-color: #edf2ef;
  font-size: 13px;
}

.table-hover tbody tr:hover {
  background: #f7fbf9;
}

.badge {
  border-radius: 999px;
  padding: 0.42em 0.68em;
  font-weight: 800;
}

.text-bg-primary {
  background-color: var(--primary) !important;
}

.text-bg-success {
  background-color: #23875a !important;
}

.text-bg-info {
  color: #123431 !important;
  background-color: #bfe4ee !important;
}

.text-bg-secondary {
  background-color: #7c8b86 !important;
}

.badge-status-pending {
  color: #4a3106;
  background: #f4cf8b;
}

.text-muted,
small.text-muted {
  color: var(--muted) !important;
}

.alert {
  border-radius: 8px;
}

.dropdown-menu {
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.modal-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(21, 127, 114, 0.16), transparent 38%),
    linear-gradient(315deg, rgba(184, 129, 45, 0.12), transparent 35%),
    #f7faf7;
}

.login-card {
  position: relative;
  width: min(92vw, 440px);
  padding: 28px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}

.login-card::before {
  content: none;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 18px;
}

.login-brand img {
  display: block;
  width: min(286px, 86%);
  height: auto;
  object-fit: contain;
}

.login-card h4 {
  margin-bottom: 8px !important;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

.pagination {
  margin-bottom: 0;
}

.pagination .page-link {
  margin-right: 4px;
  color: var(--primary);
  border-color: var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.pagination .disabled .page-link {
  color: var(--muted);
  background: #f4f7f5;
}

.qa-list-table,
.chat-table,
.monitor-table,
.users-table,
.dashboard-table {
  table-layout: fixed;
}

.qa-list-table th,
.qa-list-table td {
  text-align: left;
  vertical-align: top;
}

.qa-list-table th:nth-child(1),
.qa-list-table td:nth-child(1) {
  width: 4%;
}

.qa-list-table th:nth-child(2),
.qa-list-table td:nth-child(2) {
  width: 5%;
}

.qa-list-table th:nth-child(3),
.qa-list-table td:nth-child(3) {
  width: 11%;
}

.qa-list-table th:nth-child(4),
.qa-list-table td:nth-child(4),
.qa-list-table th:nth-child(5),
.qa-list-table td:nth-child(5) {
  width: 22%;
}

.qa-list-table th:nth-child(6),
.qa-list-table td:nth-child(6) {
  width: 11%;
}

.qa-list-table th:nth-child(7),
.qa-list-table td:nth-child(7) {
  width: 25%;
}

.qa-cell-wrap {
  color: #263935;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.qa-actions,
.users-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.qa-actions .btn {
  min-width: 54px;
  white-space: nowrap;
}

.qa-actions form {
  margin: 0;
}

.chat-result {
  min-height: 88px;
  color: #173b36;
  background: #f2f8f5;
  border: 1px solid #d8e8e0;
  white-space: pre-wrap;
}

.chat-table th:nth-child(1),
.chat-table td:nth-child(1),
.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 4%;
}

.chat-table th:nth-child(2),
.chat-table td:nth-child(2) {
  width: 10%;
}

.chat-table th:nth-child(3),
.chat-table td:nth-child(3) {
  width: 26%;
}

.chat-table th:nth-child(4),
.chat-table td:nth-child(4) {
  width: 48%;
}

.chat-table th:nth-child(5),
.chat-table td:nth-child(5) {
  width: 10%;
}

.monitor-table th:nth-child(1),
.monitor-table td:nth-child(1) {
  width: 4%;
}

.monitor-table th:nth-child(2),
.monitor-table td:nth-child(2) {
  width: 4%;
}

.monitor-table th:nth-child(3),
.monitor-table td:nth-child(3) {
  width: 11%;
}

.monitor-table th:nth-child(4),
.monitor-table td:nth-child(4) {
  width: 11%;
}

.monitor-table th:nth-child(5),
.monitor-table td:nth-child(5) {
  width: 12%;
}

.monitor-table th:nth-child(6),
.monitor-table td:nth-child(6) {
  width: 14%;
}

.monitor-table th:nth-child(7),
.monitor-table td:nth-child(7) {
  width: 8%;
}

.monitor-table th:nth-child(8),
.monitor-table td:nth-child(8) {
  width: 6%;
}

.monitor-table th:nth-child(9),
.monitor-table td:nth-child(9) {
  width: 8%;
}

.monitor-table th:nth-child(10),
.monitor-table td:nth-child(10) {
  width: 10%;
}

.monitor-table th:nth-child(11),
.monitor-table td:nth-child(11) {
  width: 16%;
}

.monitor-filter-card,
.users-filter-card {
  overflow: visible;
}

.monitor-filter-card .card-body,
.users-filter-card .card-body {
  overflow: visible;
}

.monitor-status-dropdown,
.users-filter-dropdown {
  max-height: 240px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.35;
}

.monitor-filter-grid.monitor-filter-primary {
  grid-template-columns:
    minmax(220px, 1.2fr)
    minmax(240px, 1.2fr)
    minmax(360px, 1.6fr)
    minmax(220px, 1fr);
  align-items: end;
}

.monitor-filter-primary > div {
  min-width: 0;
}

.monitor-filter-primary .form-control,
.monitor-filter-primary .form-select,
.monitor-filter-primary .btn,
.monitor-date-range {
  min-width: 0;
}

.monitor-date-range .form-control {
  width: 100%;
}

.monitor-filter-primary .form-label {
  min-height: 24px;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.status-filter-control {
  display: block;
}

.status-filter-control .dropdown {
  min-width: 0;
}

@media (max-width: 1599.98px) {
  .monitor-filter-grid.monitor-filter-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1399.98px) {
  .monitor-filter-grid.monitor-filter-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .monitor-filter-grid.monitor-filter-primary {
    grid-template-columns: 1fr;
  }

}

.monitor-filter-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr 1fr 1fr 1fr 1.8fr;
  gap: 12px;
}

.monitor-date-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.btn-priority-reply {
  color: #573300;
  background: linear-gradient(180deg, #f8d99c, #efb85c);
  border: 1px solid #dda44d;
  box-shadow: 0 0 0 rgba(184, 129, 45, 0.35);
  animation: flamePulse 1.35s ease-in-out infinite;
}

.btn-priority-reply:hover,
.btn-priority-reply:focus {
  color: #4b2a00;
  background: linear-gradient(180deg, #f4cc80, #e7a943);
  border-color: #cf9032;
}

.btn-priority-reply .bi-fire {
  margin-right: 4px;
  font-size: 0.85rem;
}

@keyframes flamePulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(184, 129, 45, 0.2);
  }
  50% {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 0 14px rgba(184, 129, 45, 0.38);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(184, 129, 45, 0.2);
  }
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 56px;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  width: 220px;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  width: 120px;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  width: 180px;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  width: 100px;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
  width: 128px;
}

.users-table th:nth-child(7),
.users-table td:nth-child(7) {
  width: 72px;
}

.users-table th:nth-child(8),
.users-table td:nth-child(8) {
  width: 140px;
}

.users-table th:nth-child(9),
.users-table td:nth-child(9) {
  width: 160px;
}

.users-table td {
  vertical-align: middle;
}

.users-ellipsis {
  display: inline-block;
  max-width: 205px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.users-table .form-select-sm,
.users-table .form-control-sm {
  min-width: 90px;
}

.user-detail-form input[readonly] {
  color: #30423e;
  background: #f5f9f7;
  border-color: #d6e2dc;
}

.users-filter-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1.1fr 1.1fr;
  gap: 12px;
}

.op-waiting-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 31, 29, 0.5);
}

.op-waiting-card {
  width: min(92vw, 460px);
  padding: 24px 20px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

body.op-waiting {
  cursor: wait;
}

.quick-message-list .quick-message-item {
  text-align: left;
  border-right: 0;
  border-left: 0;
}

.quick-message-list .quick-question {
  color: #263935;
  line-height: 1.45;
  font-weight: 800;
}

.doc-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(21, 127, 114, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(184, 129, 45, 0.1), transparent 32%),
    var(--bg);
}

.doc-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.doc-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: end;
  padding: 24px;
  color: #f6fffb;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 36%),
    #143b38;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.doc-brand {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  color: #123431;
  background: #dff5ec;
  border-radius: 8px;
  box-shadow: inset 0 -8px 18px rgba(21, 127, 114, 0.16);
}

.doc-brand-mark img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
}

.doc-brand-name {
  color: #f6fffb;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.1;
}

.doc-brand-subtitle {
  margin-top: 5px;
  color: rgba(246, 255, 251, 0.72);
  font-size: 12px;
  font-weight: 650;
}

.doc-role-badge,
.doc-reading-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  color: var(--primary);
  background: #e4f6ef;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.doc-hero h1 {
  margin: 14px 0 8px;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 950;
  line-height: 1.08;
}

.doc-hero p {
  max-width: 680px;
  margin: 0;
  color: rgba(246, 255, 251, 0.78);
  font-size: 15px;
  line-height: 1.65;
}

.doc-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-hero-actions .btn-outline-secondary {
  color: #f6fffb;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.doc-hero-actions .btn-outline-secondary:hover {
  color: #123431;
  background: #e4f6ef;
  border-color: #e4f6ef;
}

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

.doc-aside {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}

.doc-aside-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.doc-aside-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #cce6de;
  border-radius: 8px;
}

.doc-aside-icon.gold {
  color: #8a5a12;
  background: #fff1cf;
  border-color: #edd197;
}

.doc-aside-icon.danger {
  color: var(--danger);
  background: #ffe8e8;
  border-color: #f0c6c6;
}

.doc-aside-card strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.doc-aside-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.doc-card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.doc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background:
    linear-gradient(90deg, rgba(229, 244, 240, 0.95), rgba(255, 255, 255, 0.96));
  border-bottom: 1px solid var(--line);
}

.doc-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.doc-card-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
}

.doc-content {
  padding: 28px 34px 34px;
  color: #263935;
  font-size: 15px;
  line-height: 1.78;
}

.doc-content h1 {
  margin: 0 0 22px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 950;
  line-height: 1.18;
}

.doc-content h2 {
  margin: 34px 0 14px;
  padding-top: 20px;
  color: var(--primary-strong);
  border-top: 1px solid #edf3f0;
  font-size: 21px;
  font-weight: 930;
  line-height: 1.25;
}

.doc-content h3 {
  margin: 24px 0 10px;
  color: #22312e;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
}

.doc-content p {
  margin: 0 0 12px;
}

.doc-content ul,
.doc-content ol {
  margin: 0 0 18px;
  padding-left: 0;
  list-style: none;
}

.doc-content li {
  position: relative;
  margin-bottom: 10px;
  padding: 10px 12px 10px 38px;
  background: #f8fbf9;
  border: 1px solid #edf3f0;
  border-radius: 8px;
}

.doc-content ul li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 19px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 999px;
}

.doc-content ol {
  counter-reset: doc-step;
}

.doc-content ol li {
  counter-increment: doc-step;
}

.doc-content ol li::before {
  content: counter(doc-step);
  position: absolute;
  left: 12px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.doc-content code {
  padding: 2px 6px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: 6px;
}

.doc-content hr {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 1199.98px) {
  .monitor-filter-grid,
  .users-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -278px;
    z-index: 1080;
    width: 264px;
    height: 100vh;
    border-radius: 0 8px 8px 0;
    transition: left 0.24s ease;
  }

  body.sidebar-open .sidebar {
    left: 0;
  }

  .content {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .doc-layout {
    grid-template-columns: 1fr;
  }

  .doc-aside {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  body {
    font-size: 13px;
  }

  .topbar {
    display: grid;
    min-height: 0;
    padding: 14px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar-user {
    justify-content: flex-start;
  }

  .monitor-filter-grid,
  .users-filter-grid {
    grid-template-columns: 1fr;
  }

  .card {
    font-size: 12px;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding-right: 12px;
    padding-left: 12px;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table > :not(caption) > * > * {
    padding: 8px;
    font-size: 12px;
  }

  .table thead th {
    white-space: nowrap;
  }

  .chat-table {
    min-width: 760px;
  }

  .qa-list-table {
    min-width: 980px;
  }

  .monitor-table {
    min-width: 1320px;
  }

  .users-table {
    min-width: 1180px;
  }

  .qa-actions {
    gap: 6px;
  }

  .qa-actions .btn {
    min-width: 52px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .pagination .page-link {
    padding: 0.3rem 0.55rem;
    font-size: 11px;
  }

  .modal-dialog {
    max-width: calc(100vw - 0.7rem);
    margin: 0.35rem;
  }

  .modal-content {
    border-radius: 8px;
  }

  .modal-body {
    max-height: 74vh;
    overflow-y: auto;
    padding: 12px;
  }

  .modal-footer {
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
    min-width: 96px;
  }

  .modal .form-control,
  .modal .form-select,
  .modal textarea {
    font-size: 16px;
  }

  #replyModal .modal-dialog,
  #viewModal .modal-dialog,
  #medbQueryModal .modal-dialog {
    max-width: 100vw;
    height: 100vh;
    margin: 0;
  }

  #replyModal .modal-content,
  #viewModal .modal-content,
  #medbQueryModal .modal-content {
    min-height: 100vh;
    border-radius: 0;
  }

  #replyModal .modal-body,
  #viewModal .modal-body,
  #medbQueryModal .modal-body {
    max-height: calc(100vh - 130px);
  }

  .doc-shell {
    width: 100%;
    padding: 0 0 28px;
  }

  .doc-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px 16px 22px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .doc-brand {
    align-items: flex-start;
  }

  .doc-hero-actions {
    justify-content: stretch;
  }

  .doc-hero-actions .btn {
    flex: 1 1 auto;
  }

  .doc-layout {
    gap: 12px;
    margin-top: 12px;
  }

  .doc-aside {
    grid-template-columns: 1fr;
    padding: 0 12px;
  }

  .doc-aside-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
    padding: 12px;
  }

  .doc-aside-icon {
    grid-row: span 2;
    margin-bottom: 0;
  }

  .doc-aside-card p {
    margin-top: 4px;
  }

  .doc-card {
    margin: 0 12px;
  }

  .doc-card-header {
    display: grid;
    padding: 16px;
  }

  .doc-content {
    padding: 20px 16px 24px;
    font-size: 14px;
    line-height: 1.72;
  }

  .doc-content h1 {
    font-size: 23px;
  }

  .doc-content h2 {
    margin-top: 28px;
    font-size: 19px;
  }

  .doc-content h3 {
    font-size: 16px;
  }

  .doc-content li {
    padding-right: 10px;
  }
}

@media (max-width: 767.98px) {
  body {
    padding-bottom: 78px;
  }

  .content {
    padding: 0;
  }

  .page-surface {
    margin-top: 12px;
  }

  .filter-panel,
  .tool-panel-card,
  .data-workspace-card {
    margin-right: 12px;
    margin-left: 12px;
  }

  .data-workspace-card .table-responsive {
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .data-workspace-card table,
  .data-workspace-card thead,
  .data-workspace-card tbody,
  .data-workspace-card th,
  .data-workspace-card td,
  .data-workspace-card tr {
    display: block;
  }

  .data-workspace-card table,
  .data-workspace-card .qa-list-table,
  .data-workspace-card .monitor-table,
  .data-workspace-card .users-table {
    min-width: 0 !important;
    width: 100%;
  }

  .data-workspace-card thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-workspace-card tbody {
    display: grid;
    gap: 12px;
    padding: 12px;
    background: #f4f8f6;
  }

  .data-workspace-card tbody tr {
    position: relative;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
  }

  .data-workspace-card td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px 0 !important;
    border-bottom: 1px solid #eef3f0;
    font-size: 13px !important;
  }

  .data-workspace-card td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
  }

  .data-workspace-card td:last-child {
    border-bottom: 0;
  }

  .data-workspace-card td.mobile-primary-cell {
    display: block;
  }

  .data-workspace-card td.mobile-primary-cell::before,
  .data-workspace-card td[data-label="操作"]::before {
    display: block;
    margin-bottom: 8px;
  }

  .data-workspace-card td[data-label="选择"] {
    position: absolute;
    top: 10px;
    right: 12px;
    display: block;
    padding: 0 !important;
    border-bottom: 0;
  }

  .data-workspace-card td[data-label="选择"]::before {
    display: none;
  }

  .data-workspace-card td[data-label="操作"] {
    display: block;
  }

  .mobile-tabbar {
    display: grid;
  }
}

@media (max-width: 767.98px) {
  .data-workspace-card td,
  .qa-list-table th,
  .qa-list-table td,
  .monitor-table th,
  .monitor-table td {
    width: auto !important;
    max-width: none !important;
  }

  .desktop-preview {
    display: none !important;
  }

  .mobile-full {
    display: block !important;
  }

  .monitor-table td[data-label="ID"],
  .monitor-table td[data-label="提问用户"],
  .monitor-table td[data-label="答案"],
  .monitor-table td[data-label="状态"],
  .monitor-table td[data-label="命中RAG"],
  .monitor-table td[data-label="推送状态"],
  .monitor-table td[data-label="人工回复"],
  .qa-list-table td[data-label="分类"],
  .qa-list-table td[data-label="答案预览"],
  .qa-list-table td[data-label="推送状态"] {
    display: none !important;
  }

  .data-workspace-card tbody tr {
    width: 100% !important;
  }

  .monitor-table td[data-label="提问时间"],
  .qa-list-table td[data-label="ID"] {
    display: flex !important;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px !important;
    font-weight: 850;
  }

  .monitor-table td[data-label="提问时间"]::before,
  .qa-list-table td[data-label="ID"]::before {
    display: inline;
    margin: 0;
  }

  .monitor-table td[data-label="问题"],
  .qa-list-table td[data-label="问题"] {
    display: block !important;
    width: 100% !important;
    margin-top: 8px;
    color: var(--ink);
    font-size: 16px !important;
    font-weight: 900;
    line-height: 1.45;
    word-break: break-word;
  }

  .monitor-table td[data-label="问题"]::before,
  .qa-list-table td[data-label="问题"]::before,
  .monitor-table td[data-label="操作"]::before,
  .qa-list-table td[data-label="操作"]::before {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
  }

  .monitor-table td[data-label="操作"],
  .qa-list-table td[data-label="操作"] {
    display: block !important;
    width: 100% !important;
    margin-top: 10px;
  }
}


/* Kezhou workstation table tuning */
.monitor-work-table th,
.monitor-work-table td,
.activation-codes-table th,
.activation-codes-table td {
  vertical-align: middle;
}

.monitor-work-table th:nth-child(1),
.monitor-work-table td:nth-child(1) { width: 3%; }
.monitor-work-table th:nth-child(2),
.monitor-work-table td:nth-child(2) { width: 5%; }
.monitor-work-table th:nth-child(3),
.monitor-work-table td:nth-child(3) { width: 12%; }
.monitor-work-table th:nth-child(4),
.monitor-work-table td:nth-child(4) { width: 13%; }
.monitor-work-table th:nth-child(5),
.monitor-work-table td:nth-child(5) { width: 21%; }
.monitor-work-table th:nth-child(6),
.monitor-work-table td:nth-child(6) { width: 24%; }
.monitor-work-table th:nth-child(7),
.monitor-work-table td:nth-child(7) { width: 8%; }
.monitor-work-table th:nth-child(8),
.monitor-work-table td:nth-child(8) { width: 14%; }

.monitor-work-table td[data-label="操作"] {
  white-space: nowrap;
}

.monitor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}

.monitor-actions .btn {
  min-width: 66px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.activation-code-filter {
  grid-template-columns: minmax(220px, 1.2fr) minmax(112px, .64fr) minmax(112px, .64fr) minmax(160px, .9fr) minmax(260px, 1.18fr);
}

.activation-codes-table th:nth-child(1),
.activation-codes-table td:nth-child(1) { width: 38%; }
.activation-codes-table th:nth-child(2),
.activation-codes-table td:nth-child(2) { width: 10%; }
.activation-codes-table th:nth-child(3),
.activation-codes-table td:nth-child(3) { width: 10%; }
.activation-codes-table th:nth-child(4),
.activation-codes-table td:nth-child(4) { width: 20%; }
.activation-codes-table th:nth-child(5),
.activation-codes-table td:nth-child(5) { width: 22%; }

.activation-codes-table th:nth-child(2),
.activation-codes-table td:nth-child(2),
.activation-codes-table th:nth-child(3),
.activation-codes-table td:nth-child(3) {
  text-align: center;
}

.activation-code-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
  color: #183b36;
  overflow-wrap: anywhere;
}

.activation-code-filter .monitor-date-range {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.activation-code-filter .form-control,
.activation-code-filter .form-select {
  min-width: 0;
}


.file-upload-grid {
  grid-template-columns: minmax(180px, 1fr) minmax(170px, .8fr) minmax(260px, 1.3fr) minmax(220px, 1fr) auto;
}

.managed-file-filter {
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, .8fr) minmax(160px, .7fr);
}

.managed-files-table {
  table-layout: fixed;
}

.managed-files-table th:nth-child(1),
.managed-files-table td:nth-child(1) { width: 34%; }
.managed-files-table th:nth-child(2),
.managed-files-table td:nth-child(2) { width: 14%; }
.managed-files-table th:nth-child(3),
.managed-files-table td:nth-child(3) { width: 10%; }
.managed-files-table th:nth-child(4),
.managed-files-table td:nth-child(4) { width: 10%; text-align: center; }
.managed-files-table th:nth-child(5),
.managed-files-table td:nth-child(5) { width: 18%; }
.managed-files-table th:nth-child(6),
.managed-files-table td:nth-child(6) { width: 14%; }


/* Task workstation */
.task-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(21, 127, 114, 0.1), rgba(255, 255, 255, 0.96) 64%);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.task-hero > div {
  min-width: 0;
}

.task-hero h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
}

.task-hero p {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.task-eyebrow {
  margin: 0 0 4px !important;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.task-filter-grid {
  grid-template-columns: minmax(260px, 1.5fr) minmax(160px, .8fr) minmax(160px, .8fr);
}

.task-table {
  table-layout: fixed;
}

.task-table th:nth-child(1),
.task-table td:nth-child(1) { width: 38%; }
.task-table th:nth-child(2),
.task-table td:nth-child(2) { width: 12%; }
.task-table th:nth-child(3),
.task-table td:nth-child(3) { width: 12%; }
.task-table th:nth-child(4),
.task-table td:nth-child(4) { width: 8%; text-align: center; }
.task-table th:nth-child(5),
.task-table td:nth-child(5) { width: 18%; }
.task-table th:nth-child(6),
.task-table td:nth-child(6) { width: 12%; }

.task-queue-position {
  display: inline-flex;
  min-width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.task-queue-position.is-queued {
  color: #063d3b;
  background: #d6f7f1;
  border: 1px solid #9fdfd5;
}

.task-status {
  border: 1px solid transparent;
  font-weight: 850;
}

.task-status-needs_user_confirm,
.task-status-clarifying,
.task-status-collecting {
  color: #7a4c08;
  background: #fff3cd;
  border-color: #efd27d;
}

.task-status-queued,
.task-status-running,
.task-status-reviewing,
.task-status-delivering {
  color: #0e655b;
  background: var(--primary-soft);
  border-color: #addbd0;
}

.task-status-completed {
  color: #146c43;
  background: #d1e7dd;
  border-color: #a3cfbb;
}

.task-status-failed,
.task-status-cancelled {
  color: #842029;
  background: #f8d7da;
  border-color: #f1aeb5;
}

.task-form-stack {
  display: grid;
  gap: 16px;
}

.task-grid-two,
.task-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr);
  gap: 16px;
}

.task-section-card {
  border-color: #d5e3dd;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.task-section-card .card-header {
  background: linear-gradient(90deg, rgba(229, 244, 240, 0.92), rgba(255, 255, 255, 0.96));
}

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

.task-span-all {
  grid-column: 1 / -1;
}

.task-check-list {
  display: grid;
  gap: 10px;
}

.task-check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 750;
}

.task-upload-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.task-submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  background: rgba(246, 248, 245, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(14px);
}

.task-brief-box {
  max-height: 520px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #183b36;
  white-space: pre-wrap;
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-meta-list {
  display: grid;
  gap: 12px;
}

.task-meta-list div {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.task-meta-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-meta-list strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.task-assets-table td,
.task-assets-table th {
  vertical-align: middle;
}

.task-timeline {
  display: grid;
  gap: 10px;
}

.task-message-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.task-message-row span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.task-message-row div {
  color: var(--ink);
  white-space: pre-wrap;
}

@media (max-width: 991.98px) {
  .task-grid-two,
  .task-detail-grid {
    grid-template-columns: 1fr;
  }

  .task-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 767.98px) {
  .task-field-grid,
  .task-asset-grid,
  .task-filter-grid {
    grid-template-columns: 1fr;
  }

  .task-table th,
  .task-table td {
    width: auto !important;
  }

  .task-submit-bar {
    bottom: 78px;
  }
}


/* PPT task simplified layout */
.task-ppt-form {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

.task-ppt-field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-title-field .form-control {
  min-height: 56px;
  font-size: 20px;
  font-weight: 850;
}

.task-material-card {
  overflow: hidden;
}

.task-material-body {
  display: grid;
  gap: 18px;
}

.task-material-top {
  display: grid;
  grid-template-columns: minmax(260px, .62fr) minmax(320px, 1.38fr);
  gap: 16px;
  align-items: start;
}

.task-material-top-single {
  grid-template-columns: minmax(0, 1fr);
}

.task-segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.task-segmented-control label {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  margin: 0;
  cursor: pointer;
}

.task-segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.task-segmented-control span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 850;
}

.task-segmented-control input:checked + span {
  color: #063b39;
  background: var(--primary-soft);
  border-color: rgba(15, 143, 135, 0.45);
}

.task-tool-policy {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.task-tool-policy label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.task-report-workspace {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(440px, 1.08fr);
  gap: 14px;
  align-items: stretch;
}

.task-source-card {
  position: relative;
  z-index: 20;
  overflow: visible;
  border-color: rgba(15, 143, 135, 0.3);
  box-shadow: 0 14px 34px rgba(15, 143, 135, 0.09);
}

.task-source-card .card-header {
  background: linear-gradient(90deg, rgba(229, 244, 240, 0.96), rgba(255, 255, 255, 0.98));
}

.report-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.report-combobox {
  position: relative;
}

.report-combobox-control {
  position: relative;
}

.report-combobox-control > .bi-search {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 2;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.report-combobox-input {
  min-height: 44px;
  padding-right: 44px;
  padding-left: 39px;
}

.report-combobox-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
}

.report-combobox-toggle .bi {
  display: inline-block;
  transition: transform .16s ease;
}

.report-combobox-toggle.is-open .bi {
  transform: rotate(180deg);
}

.report-combobox-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 1050;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(15, 143, 135, .3);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(23, 57, 55, .16);
}

.report-combobox-list {
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.report-combobox-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.report-combobox-option:hover,
.report-combobox-option.is-active {
  background: var(--primary-soft);
}

.report-combobox-option span {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.report-combobox-option small,
.report-combobox-status {
  color: var(--muted);
  font-size: 12px;
}

.report-combobox-option mark {
  padding: 0;
  color: inherit;
  background: #fff1a8;
}

.report-combobox-status,
.report-combobox-empty {
  padding: 9px 12px;
}

.report-combobox-status {
  background: #f7faf9;
  border-top: 1px solid var(--line);
}

.report-combobox-empty {
  color: var(--muted);
  text-align: center;
}

.task-report-output,
.task-report-articles {
  min-width: 0;
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.task-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  background: linear-gradient(90deg, rgba(229, 244, 240, 0.92), rgba(255, 255, 255, 0.96));
  border-bottom: 1px solid var(--line);
}

.task-subhead strong {
  color: var(--ink);
  font-weight: 900;
}

.task-subhead span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-report-output iframe {
  display: block;
  width: 100%;
  height: 620px;
  background: #fff;
  border: 0;
}

.task-article-list {
  display: grid;
  gap: 10px;
  height: 620px;
  padding: 12px;
  overflow: auto;
  align-content: start;
}

.task-article-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 38px;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-article-score {
  display: grid;
  gap: 6px;
  align-content: start;
}

.task-article-ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  color: #063b39;
  background: var(--primary-soft);
  border: 1px solid rgba(15, 143, 135, 0.24);
  border-radius: 7px;
  font-size: 15px;
  font-weight: 950;
}

.task-article-score label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.task-article-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.task-article-title {
  font-weight: 850;
  min-height: 62px;
  resize: vertical;
}

.task-article-conclusion {
  min-height: 118px;
  font-size: 12px;
  resize: vertical;
}

.task-article-meta-grid {
  display: grid;
  grid-template-columns: minmax(80px, .8fr) minmax(120px, 1.4fr) minmax(70px, .7fr);
  gap: 8px;
}

.task-article-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.task-article-remove {
  align-self: start;
  width: 36px;
  height: 34px;
  padding: 0;
}

.task-material-card .task-upload-note {
  padding: 12px;
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-asset-stack {
  display: grid;
  gap: 14px;
}

.task-asset-stack .form-control {
  min-height: 46px;
}

.task-upload-grid-ppt {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1199.98px) {
  .task-material-top,
  .task-report-workspace {
    grid-template-columns: 1fr;
  }

  .task-tool-policy,
  .task-upload-grid-ppt {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .task-ppt-field-grid,
  .task-tool-policy,
  .task-upload-grid-ppt,
  .task-segmented-control,
  .task-article-meta-grid {
    grid-template-columns: 1fr;
  }

  .task-report-output iframe,
  .task-article-list {
    height: 520px;
  }

  .task-article-row {
    grid-template-columns: 1fr;
  }

  .task-submit-bar {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
  }

  .task-submit-bar .btn {
    width: 100%;
  }
}


/* Task confirmation page */
.task-confirm-shell {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.task-confirm-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 132px;
  padding: 22px 24px;
  background: linear-gradient(135deg, rgba(21, 127, 114, 0.1), rgba(255, 255, 255, 0.98) 66%);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.task-confirm-hero h2 {
  max-width: 980px;
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
}

.task-confirm-hero p:not(.task-eyebrow) {
  max-width: 860px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
}

.task-confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.task-confirm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
  gap: 16px;
  align-items: start;
}

.task-confirm-brief-card {
  min-width: 0;
}

.task-confirm-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.task-warning-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  color: #704d00;
  background: #fff6d8;
  border: 1px solid #f3d982;
  border-radius: 8px;
  font-weight: 750;
}

.task-warning-list div {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.task-warning-list i {
  margin-top: 2px;
  color: #b58100;
}

.task-confirm-brief {
  height: 620px;
  max-height: 62vh;
  font-size: 14px;
  line-height: 1.65;
  scrollbar-gutter: stable;
}

.task-meta-compact {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
}

.task-meta-compact div {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.task-meta-compact div:last-child {
  border-bottom: 0;
}

.task-meta-compact span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.task-meta-compact strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.task-file-list {
  display: grid;
}

.task-file-row {
  display: grid;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.task-file-row:last-child {
  border-bottom: 0;
}

.task-file-role {
  align-self: start;
  display: inline-flex;
  justify-content: center;
  padding: 4px 7px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.task-file-row strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-file-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 750;
}

.task-empty-state {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 850;
}

.task-confirm-messages {
  overflow: hidden;
}

.task-message-compact-list {
  display: grid;
  gap: 0;
  padding: 0;
}

.task-message-compact-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.task-message-compact-row:last-child {
  border-bottom: 0;
}

.task-message-compact-row span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.task-message-compact-row p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
}

@media (max-width: 1199.98px) {
  .task-confirm-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .task-confirm-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .task-confirm-hero h2 {
    font-size: 22px;
  }

  .task-confirm-actions,
  .task-confirm-actions .btn,
  .task-confirm-actions form,
  .task-confirm-actions form .btn {
    width: 100%;
  }

  .task-confirm-brief {
    height: 460px;
    max-height: 58vh;
  }

  .task-file-row,
  .task-message-compact-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .activation-code-filter,
  .managed-file-filter,
  .file-upload-grid {
    grid-template-columns: 1fr;
  }

  .activation-code-filter .monitor-date-range {
    grid-template-columns: 1fr;
  }

  .activation-code-filter .monitor-date-range span {
    display: none;
  }

  .activation-codes-table th,
  .activation-codes-table td {
    width: auto !important;
    text-align: left !important;
  }

  .activation-codes-table .badge {
    min-width: 100%;
  }
}


/* Research Command Center theme */
:root {
  --bg: #eef3f5;
  --bg-2: #e2eaed;
  --panel: #fbfdfd;
  --panel-soft: #f2f7f7;
  --ink: #12201f;
  --muted: #60716f;
  --line: #d6e1e2;
  --line-strong: #b8c9cb;
  --primary: #0f8f87;
  --primary-strong: #087169;
  --primary-soft: #dff5f1;
  --accent: #d09b3d;
  --danger: #c44952;
  --command-dark: #0c1d22;
  --command-ink: #dff8f4;
  --command-line: rgba(167, 226, 219, 0.18);
  --shadow-sm: 0 10px 28px rgba(12, 29, 34, 0.08);
  --shadow-md: 0 22px 54px rgba(12, 29, 34, 0.14);
  --shadow-focus: 0 0 0 4px rgba(15, 143, 135, 0.14);
}

body {
  background:
    linear-gradient(90deg, rgba(12, 29, 34, 0.055) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(180deg, rgba(15, 143, 135, 0.08), transparent 310px),
    linear-gradient(135deg, #eef4f5 0%, #f8fbfa 46%, #eef2ec 100%);
  color: var(--ink);
}

.layout {
  grid-template-columns: 278px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

body.sidebar-collapsed .layout {
  grid-template-columns: 92px minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(49, 218, 204, 0.16), transparent 24%),
    linear-gradient(135deg, #0b2026 0%, #112b2d 52%, #17231f 100%);
  border-color: rgba(178, 238, 230, 0.16);
  box-shadow: 0 30px 70px rgba(8, 25, 30, 0.32);
}

.sidebar-top {
  padding-bottom: 18px;
  border-bottom-color: var(--command-line);
}

.brand-mark {
  background:
    linear-gradient(145deg, rgba(236, 255, 251, 0.98), rgba(182, 238, 224, 0.9));
  border: 1px solid rgba(222, 255, 248, 0.84);
  box-shadow:
    inset 0 -10px 18px rgba(15, 143, 135, 0.18),
    0 10px 24px rgba(0, 0, 0, 0.22);
}

.brand-title {
  color: #effffb;
  font-size: 15px;
  letter-spacing: 0;
}

.nav-link-item {
  min-height: 44px;
  color: rgba(229, 250, 246, 0.75);
  border: 1px solid transparent;
}

.nav-link-item i {
  color: rgba(187, 231, 225, 0.84);
}

.nav-link-item:hover {
  background: rgba(222, 255, 249, 0.08);
  border-color: rgba(222, 255, 249, 0.12);
}

.nav-link-item.active {
  color: #051c1d;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(201, 246, 238, 0.94));
  border-color: rgba(220, 255, 248, 0.75);
  box-shadow:
    inset 0 -12px 22px rgba(15, 143, 135, 0.12),
    0 14px 30px rgba(0, 0, 0, 0.22);
}

.nav-link-item.active i {
  color: var(--primary-strong);
}

.topbar {
  min-height: 86px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(244, 250, 249, 0.86)),
    var(--panel);
  border-color: rgba(184, 201, 203, 0.88);
  box-shadow: 0 14px 36px rgba(16, 39, 44, 0.08);
}

.page-kicker {
  color: #647875;
  font-size: 12px;
  text-transform: uppercase;
}

.topbar h1,
.task-hero h2,
.task-confirm-hero h2 {
  color: #0d1d20;
  font-weight: 950;
}

.role-pill {
  color: #063b39;
  background:
    linear-gradient(180deg, rgba(231, 255, 250, 0.95), rgba(200, 245, 237, 0.9));
  border-color: rgba(91, 197, 185, 0.35);
}

.page-surface {
  margin-top: 20px;
}

.card,
.card-glass,
.task-hero,
.task-confirm-hero,
.task-submit-bar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 251, 0.94));
  border-color: rgba(190, 207, 209, 0.92);
  box-shadow: var(--shadow-sm);
}

.card-header,
.filter-panel .card-header,
.data-workspace-card .card-header,
.tool-panel-card .card-header,
.task-section-card .card-header {
  background:
    linear-gradient(90deg, rgba(224, 246, 242, 0.95), rgba(251, 253, 253, 0.95));
  border-bottom-color: rgba(187, 205, 207, 0.86);
}

.card-header strong {
  color: #132527;
  font-weight: 920;
}

.stat-card {
  min-height: 136px;
  background:
    linear-gradient(135deg, rgba(15, 143, 135, 0.13), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 249, 0.96));
  border-color: rgba(170, 199, 199, 0.95);
}

.stat-card .card-body {
  min-height: 136px;
}

.stat-card .label {
  color: #586b69;
  letter-spacing: 0;
}

.stat-card .value {
  color: #092e32;
  font-size: 38px;
}

.stat-icon {
  color: #063d3b;
  background:
    linear-gradient(180deg, #ddfbf4, #bdeee3);
  border-color: rgba(91, 197, 185, 0.34);
}

.stat-icon.gold {
  color: #5e3c04;
  background: linear-gradient(180deg, #fff3d2, #f0c46f);
}

.stat-icon.danger {
  color: #8a1f2d;
  background: linear-gradient(180deg, #ffe7ea, #f4bcc3);
}

.btn {
  border-radius: 7px;
}

.btn-primary {
  color: #effffb;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, #0b968d, #0d6f78);
  border-color: #0b7f78;
  box-shadow: 0 12px 26px rgba(13, 111, 120, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent),
    linear-gradient(135deg, #0a7e78, #0b5964);
  box-shadow: 0 14px 30px rgba(13, 111, 120, 0.3);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-success,
.btn-outline-info {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.form-control,
.form-select {
  min-height: 42px;
  background-color: rgba(255, 255, 255, 0.88);
  border-color: #c7d5d7;
  border-radius: 7px;
}

.form-control:focus,
.form-select:focus {
  border-color: #0f8f87;
  box-shadow: var(--shadow-focus);
}

.table thead th {
  color: #4e6261;
  background: #eaf2f2;
  border-bottom-color: #c5d4d6;
  font-weight: 920;
}

.table > :not(caption) > * > * {
  padding: 13px 12px;
  border-bottom-color: #e5ecec;
}

.data-workspace-card .table tbody tr:hover {
  background: rgba(235, 247, 245, 0.9);
  box-shadow: inset 4px 0 0 #0f8f87;
}

.badge,
.task-status {
  border-radius: 7px;
  letter-spacing: 0;
}

.task-status-completed,
.text-bg-success {
  color: #063b24 !important;
  background: #bdebd0 !important;
  border-color: #8fd3b1 !important;
}

.text-bg-secondary {
  color: #f7fbfa !important;
  background: #748684 !important;
}

.task-status-queued,
.task-status-running,
.task-status-reviewing,
.task-status-delivering {
  color: #063d3b;
  background: #d6f7f1;
  border-color: #9fdfd5;
}

.task-status-needs_user_confirm,
.task-status-clarifying,
.task-status-collecting {
  color: #5c3900;
  background: #fff0c4;
  border-color: #e7be55;
}

.task-status-failed,
.task-status-cancelled {
  color: #81202b;
  background: #ffe0e5;
  border-color: #eeadb7;
}

.task-hero,
.task-confirm-hero {
  background:
    linear-gradient(115deg, rgba(9, 47, 53, 0.1), transparent 36%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(236, 247, 246, 0.92));
}

.task-eyebrow {
  color: #087169;
  letter-spacing: 0.04em;
}

.task-confirm-brief,
.task-brief-box {
  color: #13292a;
  background:
    linear-gradient(90deg, rgba(15, 143, 135, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
    #fbfdfd;
  border-color: #c7d8d9;
}

.task-warning-list {
  color: #613c00;
  background: #fff4cf;
  border-color: #e4c36d;
}

.task-meta-compact div,
.task-file-row,
.task-message-compact-row {
  border-bottom-color: #e4eeee;
}

.task-file-role {
  color: #06423f;
  background: #d9f4ef;
  border: 1px solid #b2dfd7;
}

.task-submit-bar {
  background: rgba(246, 250, 249, 0.92);
  box-shadow: 0 -16px 38px rgba(12, 29, 34, 0.08);
}

.mobile-tabbar {
  background: rgba(251, 253, 253, 0.94);
  border-color: rgba(189, 207, 209, 0.92);
}

.mobile-tabbar a.active {
  color: #06423f;
  background: #dff5f1;
}

.login-page {
  background:
    linear-gradient(90deg, rgba(11, 150, 141, 0.08) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(135deg, rgba(12, 29, 34, 0.78), rgba(7, 47, 55, 0.76)),
    url("/static/brand/medbridge-logo.png") center/28vmin no-repeat fixed,
    #0c1d22;
}

.login-card {
  background: rgba(247, 252, 251, 0.9);
  border-color: rgba(216, 242, 238, 0.5);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.3);
}

body.login-page .login-card {
  background: rgba(248, 252, 251, 0.16);
}

body.login-page .login-card .form-control {
  color: #ecfffb;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(220, 255, 249, 0.3);
}

@media (max-width: 991.98px) {
  .layout {
    gap: 0;
    padding: 0;
  }

  .sidebar {
    box-shadow: 20px 0 60px rgba(8, 25, 30, 0.34);
  }
}

@media (max-width: 767.98px) {
  body {
    background:
      linear-gradient(180deg, rgba(15, 143, 135, 0.08), transparent 260px),
      #f1f5f5;
  }

  .topbar {
    box-shadow: 0 12px 32px rgba(12, 29, 34, 0.1);
  }

  .data-workspace-card tbody {
    background: #eef4f4;
  }
}

/* Final responsive guard: keep the late theme pass from restoring desktop columns on phones. */
@media (max-width: 991.98px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .layout,
  body.sidebar-collapsed .layout {
    display: block;
    width: 100%;
    min-height: 100vh;
    padding: 0;
  }

  .sidebar,
  body.sidebar-collapsed .sidebar {
    position: fixed;
    top: 0;
    left: -286px;
    z-index: 1080;
    width: min(280px, 82vw);
    height: 100dvh;
    padding: 18px 14px;
    border-radius: 0 8px 8px 0;
    transition: left 0.24s ease;
  }

  body.sidebar-open .sidebar,
  body.sidebar-open.sidebar-collapsed .sidebar {
    left: 0;
  }

  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .nav-label {
    display: grid;
  }

  body.sidebar-collapsed .sidebar-top {
    display: flex !important;
    grid-template-columns: none;
    justify-items: stretch;
    padding-right: 4px;
    padding-left: 4px;
  }

  body.sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  body.sidebar-collapsed .nav-link-item {
    justify-content: flex-start;
    padding-right: 12px;
    padding-left: 12px;
  }

  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1070;
    background: rgba(5, 19, 22, 0.34);
    backdrop-filter: blur(2px);
  }

  .content {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  .content > section,
  .topbar,
  .app-footer {
    width: 100%;
    max-width: none;
    margin-right: 0;
    margin-left: 0;
  }

  .page-surface {
    margin-top: 12px;
  }
}

@media (max-width: 767.98px) {
  .content {
    padding: 10px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: 0;
    padding: 12px;
    border-radius: 8px;
  }

  .topbar-title {
    align-items: flex-start;
    min-width: 0;
  }

  .topbar-title > div {
    min-width: 0;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .page-kicker {
    max-width: 100%;
    white-space: normal;
  }

  .topbar-user {
    width: 100%;
    justify-content: flex-start;
  }

  .mobile-tabbar {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    display: grid;
    padding: 8px;
    border-radius: 8px;
  }

  .mobile-tabbar a {
    min-width: 0;
    padding: 7px 4px;
  }

  .task-form-stack,
  .task-confirm-shell {
    gap: 12px;
  }

  .task-hero,
  .task-confirm-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .task-hero h2,
  .task-confirm-hero h2 {
    font-size: 28px;
    line-height: 1.16;
    overflow-wrap: anywhere;
  }

  .task-hero p,
  .task-confirm-hero p:not(.task-eyebrow) {
    max-width: none;
    font-size: 14px;
    line-height: 1.6;
  }

  .task-hero > .d-flex,
  .task-confirm-actions {
    display: grid !important;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .task-hero .btn,
  .task-confirm-actions .btn,
  .task-confirm-actions form {
    width: 100%;
  }

  .task-section-card,
  .task-source-card,
  .task-material-card,
  .filter-panel,
  .tool-panel-card,
  .data-workspace-card,
  .card {
    max-width: 100%;
    margin-right: 0;
    margin-left: 0;
  }

  .task-section-card .card-header,
  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .task-field-grid,
  .task-ppt-field-grid,
  .task-asset-grid,
  .task-upload-grid-ppt,
  .task-tool-policy,
  .task-material-top,
  .task-report-workspace,
  .task-confirm-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .task-tool-policy label {
    min-width: 0;
  }

  .task-report-output iframe,
  .task-article-list {
    height: min(520px, 68vh);
  }

  .task-article-row,
  .task-article-meta-grid,
  .task-article-link-row,
  .task-file-row,
  .task-message-compact-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .task-article-remove {
    width: 100%;
  }

  .task-submit-bar {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .task-submit-bar .btn {
    width: 100%;
  }

  .form-control,
  .form-select,
  textarea {
    max-width: 100%;
    font-size: 16px;
  }

  .app-footer {
    display: grid;
    gap: 4px;
    padding: 12px 4px 0;
    text-align: center;
  }

  .app-footer .mx-2 {
    display: none;
  }
}
