* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

:root {
  --blue: #1e40af;
  --bg: #f8fafc;
  --panel: #ffffff;
  --line: #e7e9f1;
  --text: #202633;
  --muted: #8a91a3;
  --soft: #f7f8fc;
  --danger: #c2410c;
  --danger-soft: #fff1f2;
  --success: #047857;
  --success-soft: #ecfdf3;
  --warning: #92400e;
  --warning-soft: #fffbeb;
}

body {
  margin: 0;
  min-width: 1280px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  width: 148px;
  padding: 18px 12px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(215, 219, 233, 0.8);
  display: flex;
  flex-direction: column;
}

.logo {
  margin: 4px 8px 28px;
  font-weight: 800;
  font-size: 17px;
}

.side-item,
.side-link {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  margin-bottom: 8px;
  color: #3d4353;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-decoration: none;
  font-size: 15px;
}

.side-item.active,
.side-item:hover,
.side-link:hover {
  color: var(--blue);
  background: #ffffff;
}

.recycle-nav-item {
  margin-top: auto;
}

.app-shell {
  margin-left: 148px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 18px 28px;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

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

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

.top-actions .view-topbar-action {
  flex: 0 0 auto;
}

#saveStatus {
  color: #516079;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
}

#saveStatus:empty {
  display: none;
}

#saveStatus[data-type="success"] {
  color: #16875f;
  border-color: #c9efdd;
  background: #eaf8f2;
}

#saveStatus[data-type="error"] {
  color: #c52b2b;
  border-color: #ffd5d5;
  background: #fff0f0;
}

.primary-button,
.ghost-button,
.link-button,
.back-button,
.secondary-button,
.danger-button,
.toolbar button,
.search-box button {
  height: 34px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  color: #ffffff;
  background: var(--blue);
  border: 1px solid var(--blue);
}

.primary-button:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.ghost-button,
.toolbar button,
.search-box button {
  color: #283044;
  background: #ffffff;
  border: 1px solid var(--line);
}

.danger-button {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #fecdd3;
}

.small-button {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.secondary-button {
  color: #283044;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 600;
}

.secondary-button.danger-button {
  color: var(--danger);
  border-color: #fecdd3;
  background: var(--danger-soft);
}

.link-button,
.back-button {
  color: var(--blue);
  background: transparent;
  border: 0;
}

.table-link {
  height: auto;
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.toolbar {
  flex: 0 0 auto;
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--panel);
  border-radius: 4px;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex !important;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #475467;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.status-success {
  color: var(--success);
  border-color: #bbf7d0;
  background: var(--success-soft);
}

.status-warning {
  color: var(--warning);
  border-color: #fde68a;
  background: var(--warning-soft);
}

.status-danger {
  color: #b42318;
  border-color: #fecdd3;
  background: #fff1f2;
}

.status-info {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.status-neutral {
  color: #667085;
  border-color: #e5e7eb;
  background: #f8fafc;
}

.toolbar select {
  min-width: 142px;
}

.list-view,
.knowledge-view,
.content-view,
.conversations-view,
.data-view,
.finance-view,
.recharge-view,
.placeholder-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.conversations-view,
.recharge-view {
  overflow: hidden;
}

#conversationSections,
#rechargeSections {
  height: 100%;
  min-height: 0;
}

#dataSections {
  min-height: 100%;
}

#financeSections {
  min-height: 100%;
}

.toolbar .primary-button {
  min-width: 132px;
}

select,
input,
textarea {
  border: 1px solid #dfe3ee;
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

select,
input {
  height: 34px;
  padding: 0 12px;
}

textarea {
  min-height: 108px;
  padding: 12px;
  resize: none;
  line-height: 1.6;
  font-size: 14px;
}

.search-box {
  display: flex;
  align-items: center;
}

.search-box input {
  width: 260px;
  border-radius: 5px 0 0 5px;
}

.search-box button {
  border-left: 0;
  border-radius: 0 5px 5px 0;
}

.toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.quota {
  margin-left: auto;
  color: #727a8f;
}

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

.agent-card {
  min-height: 190px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 32px;
  gap: 12px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.agent-card:hover {
  border-color: #c5cbff;
  box-shadow: 0 8px 18px rgba(30, 64, 175, 0.05);
}

.agent-card img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px;
}

.agent-card h3 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.agent-card-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.visibility-tag {
  max-width: 112px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.agent-card .price {
  margin-top: 6px;
  color: #ff3b30;
  font-size: 13px;
}

.agent-card .desc {
  min-height: 40px;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 48px;
  margin-top: 8px;
  overflow: hidden;
}

.tag {
  color: #1d4ed8;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  background: #eff6ff;
  white-space: nowrap;
}

.tag.published {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bbf7d0;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.card-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 10px;
  color: #b0b6c5;
  border-top: 1px solid var(--line);
}

.channel-link {
  color: var(--blue);
}

.more-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #f3f5fa;
  color: #4f596d;
  font-weight: 800;
}

.detail-view {
  position: relative;
  width: 100%;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.agent-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px 22px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px 4px 0 0;
}

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

.agent-title-group img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px;
}

.back-list-button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  color: #2f3b55;
  background: #f8fafc;
  border: 1px solid #dbe3f0;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.detail-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.hero-card {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 24px;
}

.hero-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  object-position: top center;
  border-radius: 14px;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-line h2 {
  font-size: 18px;
}

.hero-card p {
  margin-top: 8px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 8px;
  padding-right: 12px;
}

.status-pill {
  color: #647086;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 13px;
}

.status-pill.published {
  color: #16875f;
  background: #eaf8f2;
  border-color: #c9efdd;
}

.detail-tabs {
  display: flex;
  gap: 38px;
  margin-top: 18px;
  padding: 0 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-page-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 36px;
  height: 48px;
  padding: 0 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 0;
}

.agent-page-tab,
.config-tab {
  color: #2e3547;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 15px;
}

.agent-page-tab.active,
.config-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.agent-page {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#appPage {
  display: flex;
  flex-direction: column;
}

#appPage.hidden {
  display: none !important;
}

.creator-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 420px clamp(350px, 25vw, 390px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 0;
}

.prompt-column,
.config-column,
.preview-column {
  min-width: 0;
  min-height: 0;
  padding: 10px 16px 8px;
  border-right: 1px solid var(--line);
}

.preview-column {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  justify-items: center;
  padding: 10px 40px 12px 12px;
}

#appPage:not(.hidden) .preview-column {
  position: absolute;
  top: 84px;
  right: 0;
  bottom: 0;
  z-index: 4;
  width: clamp(350px, 25vw, 390px);
  min-width: 350px;
  padding: 10px 34px 12px 4px;
  border-left: 1px solid var(--line);
  border-right: 0;
  background: #ffffff;
}

.prompt-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.config-column {
  overflow-y: auto;
  padding-right: 28px;
  scrollbar-gutter: stable;
}

.preview-column {
  border-right: 0;
}

.preview-column > h3 {
  position: absolute;
  top: 16px;
  right: 11px;
  z-index: 1;
  margin: 0;
  color: #334052;
  font-size: 15px;
  letter-spacing: 0.12em;
  line-height: 1.1;
  writing-mode: vertical-rl;
}

.model-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  align-items: center;
  position: relative;
  min-width: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.model-picker {
  position: relative;
  min-width: 0;
}

.model-trigger {
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: #263047;
  background: #ffffff;
  border: 1px solid #dfe3ee;
  border-radius: 5px;
  font-size: 14px;
}

.model-trigger-arrow {
  color: #a5abba;
  font-size: 18px;
}

.model-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 12px);
  right: 0;
  width: 100%;
  max-width: 100%;
  min-width: 220px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e4e8f1;
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(20, 28, 48, 0.16);
}

.model-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 28px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-left: 1px solid #e4e8f1;
  border-top: 1px solid #e4e8f1;
  transform: rotate(45deg);
}

.model-popover h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.model-popover label {
  display: grid;
  gap: 8px;
}

.model-popover select {
  width: 100%;
  height: 34px;
  min-width: 0;
}

.model-diversity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  padding: 12px 0 0;
}

.prompt-column > .model-row + .model-diversity,
.prompt-column > .model-diversity {
  display: none !important;
}

.model-popover .model-diversity {
  display: grid !important;
}

.model-diversity > div {
  display: grid;
  gap: 4px;
}

.model-diversity strong {
  font-size: 14px;
  white-space: nowrap;
}

.model-diversity p {
  margin-top: 0;
  color: var(--muted);
  line-height: 1.35;
  font-size: 12px;
}

.model-diversity input[type="range"] {
  grid-column: 1;
  width: 100%;
  padding: 0;
  align-self: center;
}

.model-diversity input[type="number"] {
  grid-column: 2;
  width: 72px;
  height: 32px;
}

.panel-title,
.setting-title,
.inline-title,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (min-width: 1800px) {
  .agent-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.section-actions-head {
  justify-content: flex-end;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.knowledge-view .section-actions-head {
  justify-content: flex-start;
}

.panel-title {
  flex: 0 0 auto;
  margin: 8px 0 6px;
}

.panel-title h3,
.setting-title strong,
.model-row strong,
.preview-column > h3 {
  font-size: 16px;
}

.prompt-textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: auto;
  max-height: none;
  background: #f2f4fa;
  border: 0;
  border-radius: 8px;
  overflow-y: auto;
}

.char-counter {
  flex: 0 0 auto;
  min-height: 20px;
  margin-top: 6px;
  padding-right: 2px;
  color: #b0b5c3;
  font-size: 13px;
  line-height: 20px;
  text-align: right;
}

.config-tabs {
  display: flex;
  gap: 34px;
  height: 38px;
  border-bottom: 1px solid var(--line);
}

.config-panel {
  min-width: 0;
  padding-top: 16px;
}

.setting-block {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.setting-title span,
.muted-text {
  color: var(--muted);
}

.setting-title > * {
  min-width: 0;
}

.muted-text {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.switch-line {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 2px;
  color: var(--blue);
}

.setting-title .switch-line:has(#knowledgeEnabledInput) {
  display: none;
}

.inline-add {
  width: fit-content;
  color: var(--blue);
  background: transparent;
  border: 0;
}

.danger-link {
  color: #f04d4f;
}

.quick-button-list,
.phone-quick-buttons,
.knowledge-bindings {
  display: grid;
  gap: 10px;
}

.quick-button-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 10px;
}

.opening-question-list {
  display: grid;
  gap: 10px;
}

.opening-question-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 10px;
}

.opening-question-row .icon-button:disabled {
  color: #b8becb;
  cursor: not-allowed;
}

.icon-button {
  color: #4a5368;
  background: #f4f6fb;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.kb-binding {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f8f9fd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kb-binding .check-line span {
  color: var(--muted);
}

.kb-binding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: default;
}

.kb-binding-head > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.kb-binding-head strong,
.kb-binding-head span {
  overflow-wrap: anywhere;
}

.kb-binding-head span,
.kb-binding-note {
  color: var(--muted);
  font-size: 13px;
}

.kb-bound-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kb-bound-files span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 8px;
  color: #4a5368;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.remove-bound-file {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #8b95a7;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  line-height: 14px;
}

.remove-bound-file:hover {
  color: #ffffff;
  background: #ef4444;
}

.kb-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.kb-controls label {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.kb-controls select,
.kb-controls input {
  width: 100%;
  height: 40px;
}

.disabled-block {
  color: var(--muted);
  background: #f8f9fd;
  padding: 14px;
  border-radius: 8px;
}

.skill-card {
  background: #ffffff;
}

.add-kb-inline {
  height: 42px;
  color: var(--blue);
  background: #f5f6fb;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
}

.chat-bg-upload {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  color: #8d93a2;
  background: #f7f8fc;
  border: 1px solid #d8deeb;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
}

.chat-bg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: -2px;
}

.chat-bg-upload.has-image {
  border-style: solid;
}

.chat-bg-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bottom-save-bar {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-top: 0;
}

.simple-editor-card,
.placeholder-card,
.knowledge-view {
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.simple-editor-card {
  display: grid;
  gap: 18px;
  max-width: 900px;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  margin-top: 18px;
}

.folder-list,
.knowledge-table-card {
  background: #f8f9fd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.folder-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 12px;
  color: #30384a;
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 6px;
}

.folder-item.active {
  color: var(--blue);
  border-color: #c5cbff;
}

.folder-row {
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.folder-row:hover {
  background: #f1f5ff;
  border-color: #d7def7;
}

.table-title {
  margin-bottom: 12px;
  font-weight: 800;
}

.knowledge-file-list,
.kb-row,
.file-row {
  display: grid;
  gap: 8px;
}

.kb-row,
.file-row {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 8px;
}

.kb-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.kb-row > div {
  display: grid;
  gap: 8px;
}

.kb-row > .kb-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.file-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

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

.file-main > span {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.knowledge-upload-guidance {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  color: #556070;
  background: #f7f9ff;
  border: 1px solid #e6ebf5;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
}

.knowledge-upload-guidance strong {
  color: #2d3650;
}

.knowledge-upload-guidance-main {
  margin: 12px 0 14px;
}

.file-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.file-meta-grid em {
  font-size: 12px;
}

.kb-file-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 20px;
  color: var(--muted);
  background: #f8faff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid #eef1f7;
}

.kb-file-stats.compact {
  padding: 10px 20px;
  background: #fbfcff;
}

.kb-file-stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid #dbe4ff;
  border-radius: 999px;
  background: #fff;
  color: #566178;
  font-size: 12px;
}

.kb-file-stats strong {
  color: var(--blue);
  font-size: 13px;
}

.kb-file-stats .warn strong {
  color: #d97706;
}

.kb-file-stats em {
  flex: 1;
  min-width: 260px;
  color: #8a93a5;
  font-size: 12px;
  font-style: normal;
}

.kb-row span,
.kb-row em,
.file-row em {
  color: var(--muted);
  font-style: normal;
}

.health-pill {
  min-width: 84px;
  padding: 5px 10px;
  text-align: center;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.health-callable {
  color: #0f8a4b !important;
  background: #eaf8f0;
  border-color: #bfe9d0;
}

.health-pending {
  color: #8a6d12 !important;
  background: #fff7df;
  border-color: #f0dda3;
}

.health-no_chunks,
.health-missing_source,
.health-missing_parsed,
.health-parse_failed {
  color: #d93025 !important;
  background: #fff0ef;
  border-color: #ffd0cc;
}

.file-row.health-missing_source,
.file-row.health-missing_parsed,
.file-row.health-parse_failed,
.file-row.health-no_chunks,
.kb-file-row.health-missing_source,
.kb-file-row.health-missing_parsed,
.kb-file-row.health-parse_failed,
.kb-file-row.health-no_chunks {
  border-color: #ffd0cc;
  background: #fffafa;
}

.empty-file-row {
  grid-template-columns: 1fr auto;
}

.detail-tab {
  height: 50px;
  padding: 0;
  color: #2e3547;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
}

.detail-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 18px;
  margin-top: 18px;
}

.editor-column,
.editor-column {
  min-height: 560px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
}

.tab-panel {
  display: grid;
  gap: 18px;
}

.tab-panel h3 {
  font-size: 19px;
}

label {
  display: grid;
  gap: 8px;
  color: #30384a;
}

.avatar-load-failed {
  visibility: hidden;
}

.form-note {
  color: var(--muted);
  background: var(--soft);
  border-radius: 6px;
  padding: 12px;
  line-height: 1.6;
}

.radio-grid {
  display: flex;
  gap: 26px;
}

.radio-grid label,
.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sale-option-grid {
  display: grid;
  gap: 8px;
}

.sale-option {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #30384a;
}

.sale-option input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.sale-option.active {
  color: var(--text);
  font-weight: 600;
}

.sale-option.disabled {
  color: var(--muted);
}

.sale-option.disabled input {
  cursor: not-allowed;
}

.option-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eaf8f2;
  color: #16875f;
  font-size: 12px;
  font-weight: 600;
}

.option-badge.muted {
  background: var(--soft);
  color: var(--muted);
}

.listing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 6px;
  color: #30384a;
}

.listing-toggle input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.listing-toggle strong {
  min-width: 34px;
  color: #16875f;
}

.listing-toggle strong[data-state="off"] {
  color: var(--muted);
}

.readonly-state-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 6px;
  color: var(--muted);
}

#salePage .simple-editor-card {
  padding: 14px 18px 18px;
  max-height: 100%;
  overflow-y: auto;
}

#salePage .setting-block {
  margin-top: 10px;
  padding: 10px 12px;
}

#salePage .setting-block .muted-text {
  margin-top: 5px;
  line-height: 1.45;
}

#salePage .sale-option-grid {
  gap: 6px;
}

#salePage .save-inline-button {
  margin-top: 10px;
}

.check-line.disabled {
  color: var(--muted);
}

.check-line.disabled input {
  cursor: not-allowed;
}

.radio-grid input,
.check-line input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.channel-preview {
  padding: 16px;
  background: var(--soft);
  border-radius: 8px;
  line-height: 1.8;
}

.channel-preview p {
  color: var(--muted);
}

.channel-mvp {
  min-height: 100%;
  padding: 0 24px 48px;
  background: #f7f8fc;
}

.channel-head,
.channel-filters,
.channel-table-wrap {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.channel-head,
#channelEntryFilter {
  display: none;
}

.channel-head {
  padding: 18px 20px;
}

.channel-head h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.channel-head p {
  margin: 0 0 8px;
  color: #48536a;
}

.channel-head small {
  color: #7b8497;
}

.channel-filters {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(112px, 0.7fr) minmax(130px, 0.9fr) minmax(150px, 1fr) minmax(126px, 0.8fr) minmax(220px, 1.4fr) 72px;
  gap: 10px;
  margin-top: 0;
  padding: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.channel-filters input,
.channel-filters select {
  height: 36px;
}

.channel-filters button,
.channel-actions button {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #d8deea;
  border-radius: 6px;
  color: #3139ff;
  background: #ffffff;
  cursor: pointer;
}

.channel-table-wrap {
  margin-top: 14px;
  overflow-x: hidden;
}

.channel-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.channel-table th,
.channel-table td {
  padding: 11px 9px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.channel-table th {
  color: #667085;
  background: #fbfcff;
  font-weight: 700;
}

.channel-table th:nth-child(1) { width: 23%; }
.channel-table th:nth-child(2) { width: 11%; }
.channel-table th:nth-child(3) { width: 15%; }
.channel-table th:nth-child(4) { width: 9%; }
.channel-table th:nth-child(5) { width: 10%; }
.channel-table th:nth-child(6) { width: 13%; }
.channel-table th:nth-child(7) { width: 19%; }

.channel-table td:nth-child(2),
.channel-table td:nth-child(3),
.channel-table td:nth-child(4),
.channel-table td:nth-child(5),
.channel-table td:nth-child(6) {
  white-space: nowrap;
}

.channel-agent-cell {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.channel-agent-cell img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
}

.channel-agent-cell strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-table td small {
  display: block;
  margin-top: 4px;
  max-width: 130px;
  overflow: hidden;
  color: #8d93a2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-miniapp-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.channel-miniapp-cell strong {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.channel-miniapp-cell span {
  justify-self: start;
  padding: 2px 7px;
  border-radius: 999px;
  color: #526070;
  background: #eef2f7;
  font-size: 12px;
  line-height: 1.4;
}

.channel-table code {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f4f8;
  overflow: hidden;
  color: #374151;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #647086;
  background: #f2f4f8;
  white-space: nowrap;
}

.channel-pill.on {
  color: #148a42;
  background: #eaf8ef;
}

.channel-pill.off {
  color: #a15c00;
  background: #fff5e5;
}

.channel-entry-summary {
  display: inline-grid;
  gap: 4px;
  min-width: 0;
}

.channel-entry-summary span {
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: center;
  gap: 4px;
  color: #667085;
  font-size: 12px;
  white-space: normal;
}

.channel-entry-summary strong {
  padding: 2px 6px;
  border-radius: 999px;
  color: #148a42;
  background: #eaf8ef;
  font-size: 12px;
  white-space: nowrap;
}

.channel-entry-summary small {
  color: #8d93a2;
  font-size: 11px;
  line-height: 1.4;
  white-space: normal;
}

.channel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.channel-actions button {
  flex: 0 0 auto;
  min-width: 78px;
  padding: 0 10px;
  white-space: nowrap;
}

.channel-actions [data-channel-action="toggle-entry"] {
  display: none;
}

.channel-actions button:hover,
.channel-filters button:hover {
  border-color: #3139ff;
  background: #eef2ff;
}

.channel-empty {
  padding: 32px;
  color: #8d93a2;
  text-align: center;
}

.channel-entry-modal {
  place-items: center;
  padding: 28px;
}

.modal-card.channel-entry-card {
  width: min(840px, calc(100vw - 72px));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.channel-entry-card .modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.channel-entry-card .modal-head h3 {
  margin: 0 0 8px;
  font-size: 20px;
  color: #111827;
}

.channel-entry-card .modal-head p {
  max-width: 620px;
  color: #667085;
  line-height: 1.65;
}

.channel-entry-card .modal-close {
  flex: 0 0 auto;
  margin: -4px -6px 0 0;
}

.channel-entry-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 176px;
  gap: 22px;
  align-items: start;
  padding: 24px 28px;
  overflow: auto;
}

.channel-entry-cover {
  width: 120px;
  height: 120px;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}

.channel-entry-info {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.channel-entry-info strong {
  font-size: 18px;
  color: #111827;
}

.channel-entry-info p {
  color: #667085;
  line-height: 1.6;
}

.channel-entry-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.channel-entry-status span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #f2f4f8;
  color: #647086;
  font-size: 12px;
}

.channel-entry-status span.on {
  color: #148a42;
  background: #eaf8ef;
}

.channel-entry-status span.off {
  color: #a15c00;
  background: #fff5e5;
}

.channel-entry-miniapp {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.channel-entry-miniapp div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.channel-entry-miniapp span,
.channel-entry-miniapp strong {
  display: block;
  min-width: 0;
}

.channel-entry-miniapp span {
  margin-bottom: 4px;
  color: #7b8497;
  font-size: 12px;
}

.channel-entry-miniapp strong {
  overflow: hidden;
  color: #111827;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.channel-entry-info label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #7b8497;
  font-size: 12px;
}

.channel-entry-info label code {
  display: block;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8f9fc;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-entry-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #7b8497;
  font-size: 12px;
}

.channel-entry-qr img {
  width: 168px;
  height: 168px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.channel-entry-card .modal-actions {
  flex: 0 0 auto;
  padding: 18px 28px 24px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.phone {
  width: min(100%, 430px, calc(46.1538vh - 94px));
  max-width: 100%;
  min-height: 0;
  height: auto;
  max-height: 932px;
  aspect-ratio: 9 / 19.5;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border-radius: 24px;
  background: #f8fafc;
  background-size: cover;
  background-position: center;
  border: 1px solid #dfe4f0;
  margin: 2px auto 0;
}

.phone-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 14px 14px;
  scrollbar-gutter: stable;
}

.phone-scroll::-webkit-scrollbar {
  width: 6px;
}

.phone-scroll::-webkit-scrollbar-thumb {
  background: rgba(74, 82, 112, 0.34);
  border-radius: 999px;
}

.phone-nav {
  flex: 0 0 auto;
  min-height: 52px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid #e6ebf3;
}

.phone-nav-back {
  position: relative;
  width: 24px;
  height: 34px;
  flex: 0 0 24px;
}

.phone-nav-back::before {
  position: absolute;
  top: 50%;
  left: 8px;
  width: 9px;
  height: 9px;
  border-left: 2px solid #1f2933;
  border-bottom: 2px solid #1f2933;
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.phone-nav img {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
  border: 1px solid #e1e7f0;
}

.phone-nav strong {
  min-width: 0;
  overflow: hidden;
  color: #1f2933;
  font-size: 4cqw;
  line-height: 28px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-agent-cover {
  display: none;
}

.phone-agent-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.phone-intro {
  margin: 10px 4px;
  color: #667085;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
  white-space: pre-line;
}

.phone-message-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 16px;
}

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

.phone-assistant-avatar,
.phone-user-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
}

.phone-assistant-avatar {
  object-fit: cover;
  object-position: top center;
  background: #d9dee8;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.08);
}

.phone-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: #2563eb;
  font-size: 12px;
  font-weight: 800;
}

.phone-card,
.phone-message-bubble {
  width: fit-content;
  max-width: calc(100% - 36px);
  margin: 0;
  padding: 13px 15px;
  border: 1px solid #e6ebf3;
  border-radius: 12px;
  border-top-left-radius: 8px;
  background: #ffffff;
  box-shadow: 0 5px 12px rgba(31, 41, 51, 0.035);
}

.phone-card h4 {
  display: none;
}

.phone-card p {
  margin: 0;
  color: #333b4f;
  line-height: 1.5;
  font-size: 4cqw;
  white-space: pre-line;
}

.quick-tip {
  width: fit-content;
  margin: 0 0 7px 35px;
  padding: 7px 11px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: #ffffff;
  color: #2563eb;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.quick-tip:hover {
  color: #3139ff;
  background: #eef2ff;
}

.phone-chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  color: #8d93a2;
  font-size: 12px;
}

.phone-chat-toolbar button {
  border: 0;
  background: transparent;
  color: #3139ff;
  cursor: pointer;
}

.phone-chat-messages {
  min-height: 0;
  max-height: none;
  margin-top: 10px;
  padding: 0;
  display: grid;
  gap: 0;
  align-content: start;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.phone-chat-messages:empty {
  display: none;
}

.phone-chat-empty {
  color: #8d93a2;
  font-size: 12px;
  line-height: 1.5;
}

.phone-chat-message {
  display: flex;
}

.phone-chat-message p {
  width: fit-content;
  max-width: calc(100% - 36px);
  margin: 0;
  padding: 10px 13px;
  border-radius: 12px;
  color: #344054;
  background: #ffffff;
  line-height: 1.5;
  font-size: 4.13cqw;
  white-space: pre-line;
  word-break: break-word;
}

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

.phone-chat-message.user p {
  color: #ffffff;
  background: #2563eb;
  border-top-right-radius: 7px;
}

.phone-chat-message.assistant p {
  border-top-left-radius: 7px;
}

.phone-chat-message.error p {
  color: #b42318;
  background: #fff1f0;
}

.phone-input {
  position: relative;
  flex: 0 0 auto;
  min-height: 62px;
  margin: 0;
  padding: 8px 14px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(246, 248, 251, 0.97);
  border-radius: 0;
  border: 0;
  border-top: 1px solid rgba(31, 41, 51, 0.055);
}

.phone-input input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  border: 0;
  border-radius: 21px;
  outline: 0;
  background: #ffffff;
  color: #111827;
  font-size: 4cqw;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 51, 0.065);
}

.phone-input button,
.phone-plus-button {
  position: relative;
  flex: 0 0 auto;
  width: 9.0667cqw;
  height: 9.0667cqw;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #4b5563;
  background: #e5eaf1;
  cursor: pointer;
}

.phone-plus-button {
  color: #2563eb;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14);
}

.phone-plus-button span::before,
.phone-plus-button span::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.7333cqw;
  height: 0.5333cqw;
  border-radius: 2px;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
}

.phone-plus-button span::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

#phoneChatSendButton::before,
#phoneChatSendButton::after {
  position: absolute;
  left: 50%;
  top: 50%;
  content: "";
}

#phoneChatSendButton::before {
  width: 2.9333cqw;
  height: 2.9333cqw;
  border-left: 0.6667cqw solid currentColor;
  border-top: 0.6667cqw solid currentColor;
  transform: translate(-50%, -40%) rotate(45deg);
}

#phoneChatSendButton::after {
  width: 0.6667cqw;
  height: 4cqw;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -36%);
}

.phone-safe-area {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: env(safe-area-inset-bottom);
  pointer-events: none;
}

.phone-input button:disabled {
  cursor: wait;
  background: #9aa4ff;
}

.preview-column .full {
  width: 100%;
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.42);
}

.admin-confirm-modal {
  z-index: 120;
}

.modal-card {
  width: min(980px, calc(100vw - 80px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
}

.model-edit-dialog {
  width: min(560px, calc(100vw - 40px)) !important;
}

.model-config-dialog {
  width: min(1040px, calc(100vw - 40px)) !important;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.model-config-dialog .modal-title,
.model-config-dialog .modal-actions {
  flex: 0 0 auto;
}

.model-config-dialog .modal-actions {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.model-config-dialog .model-edit-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 22px 24px;
}

.model-config-dialog .model-form-section {
  display: grid;
  gap: 14px;
  align-content: start;
}

.model-config-dialog .model-form-section h3 {
  margin: 4px 0 2px;
  font-size: 14px;
  color: #111827;
}

.model-config-dialog .model-edit-form label {
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 12px;
  font-size: 13px;
}

.model-config-dialog .model-secret-field {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  font-size: 13px;
  color: #444;
}

.model-secret-panel {
  display: grid;
  gap: 8px;
}

.model-secret-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 6px 8px 6px 10px;
  border: 1px solid #d9dce6;
  border-radius: 6px;
  background: #fbfcff;
}

.model-secret-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
}

.model-secret-status.configured {
  color: #047857;
  background: #dcfce7;
}

.model-secret-status.missing {
  color: #92400e;
  background: #fef3c7;
}

.model-secret-input-row {
  display: grid !important;
  grid-template-columns: minmax(86px, 110px) minmax(0, 1fr) !important;
}

.model-secret-input-row.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .model-config-dialog .model-edit-form {
    grid-template-columns: 1fr;
  }
  .model-config-dialog .model-edit-form label {
    grid-template-columns: 1fr;
  }
  .model-config-dialog .model-secret-field,
  .model-secret-input-row {
    grid-template-columns: 1fr !important;
  }
}

.wide-modal {
  width: min(1400px, calc(100vw - 80px));
}

.knowledge-modal-card {
  width: min(900px, calc(100vw - 80px));
  max-height: min(86vh, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.knowledge-edit-modal-card {
  width: min(680px, calc(100vw - 80px));
}

.knowledge-edit-form textarea {
  min-height: 92px;
  resize: vertical;
  padding: 8px 10px;
  color: var(--text);
  border: 1px solid #d9dce6;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.knowledge-file-name-editor {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(540px, 100%);
  min-width: 0;
}

.knowledge-file-name-editor input {
  flex: 1 1 420px;
  width: min(480px, 100%);
  min-width: 360px;
}

.knowledge-file-name-editor em {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #4b5563;
  background: #f3f6fb;
  border: 1px solid #d9dce6;
  border-radius: 6px;
  font-style: normal;
  font-size: 13px;
}

.knowledge-edit-form .form-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .knowledge-edit-modal-card {
    width: calc(100vw - 32px);
  }

  .knowledge-file-name-editor {
    flex-wrap: wrap;
  }

  .knowledge-file-name-editor input {
    width: 100%;
    min-width: 0;
  }
}

.knowledge-edit-form .form-error {
  margin: 0;
  color: #b91c1c;
  font-size: 12px;
}

.service-modal-card {
  width: min(820px, calc(100vw - 80px));
}

.chat-bg-modal-card {
  width: min(1360px, calc(100vw - 80px));
}

.chat-bg-preview-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 360px;
  gap: 20px;
  padding: 24px;
}

.chat-bg-web-preview,
.chat-bg-mobile-preview {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: 8px;
  background-color: #f5e5d8;
  background-size: cover;
  background-position: center;
}

.chat-bg-mobile-preview {
  max-width: 360px;
}

.chat-bg-web-preview > span,
.chat-bg-mobile-preview > span,
.bg-preview-tag {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 2;
  padding: 7px 10px;
  color: #ffffff;
  background: rgba(35, 31, 28, 0.52);
  border-radius: 4px;
  font-weight: 700;
}

.bg-preview-tag {
  top: 104px;
}

.bg-preview-card,
.bg-preview-pill {
  position: absolute;
  z-index: 1;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 14px;
  backdrop-filter: blur(4px);
}

.large-card {
  left: 26px;
  top: 118px;
  width: 82%;
  height: 150px;
}

.wide-pill {
  right: 22px;
  top: 304px;
  width: 44%;
  height: 48px;
  background: rgba(70, 66, 60, 0.32);
  border-radius: 18px;
}

.small-card {
  left: 26px;
  bottom: 178px;
  width: 47%;
  height: 50px;
}

.mobile-card {
  left: 30px;
  top: 112px;
  width: 76%;
  height: 172px;
}

.mobile-small-card {
  left: 28px;
  bottom: 182px;
  width: 52%;
  height: 54px;
}

.split-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.split-actions > div {
  display: flex;
  gap: 12px;
}

.confirm-modal-card {
  width: min(640px, calc(100vw - 80px));
  padding-bottom: 16px;
}

.confirm-body {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 26px 24px 10px;
  font-size: 18px;
}

.warning-dot {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  background: #ffad1f;
  border-radius: 50%;
  font-weight: 800;
}

.modal-title {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-title > :first-child {
  min-width: 0;
}

.publish-readiness-card {
  width: min(860px, calc(100vw - 48px));
  max-height: min(820px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agent-publish-readiness-modal .modal-title,
.agent-publish-readiness-modal .publish-readiness-summary,
.agent-publish-readiness-modal .publish-history-compact,
.agent-publish-readiness-modal .modal-actions {
  flex: 0 0 auto;
}

.publish-target-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.publish-target-field select {
  min-height: 40px;
  border: 1px solid #d9dce6;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.publish-readiness-summary,
.publish-history-compact {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid #eceef3;
}

.publish-readiness-summary {
  flex-wrap: wrap;
}

.publish-readiness-summary strong {
  min-width: 0;
}

.publish-readiness-summary span,
.publish-history-compact span {
  color: #69707f;
  font-size: 13px;
}

.publish-readiness-list {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 0;
  padding: 8px 24px 16px;
  scrollbar-gutter: stable;
}

.publish-readiness-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f1f4;
}

.publish-readiness-item > span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  white-space: nowrap;
  line-height: 1.4;
  font-size: 12px;
  font-weight: 700;
  color: #9a6700;
}

.publish-readiness-item > div {
  min-width: 0;
}

.publish-readiness-item strong {
  display: block;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.publish-readiness-item[data-level="BLOCKING"] > span {
  color: #b42318;
}

.publish-readiness-item[data-level="PASSED"] > span {
  color: #067647;
}

.publish-readiness-item p,
.publish-readiness-item small {
  margin: 4px 0 0;
  color: #69707f;
  line-height: 1.5;
}

.publish-history-compact {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.agent-publish-readiness-modal .modal-actions {
  padding: 14px 24px 18px;
  border-top: 1px solid #eceef3;
  background: #ffffff;
}

@media (max-width: 720px) {
  .publish-readiness-card {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .agent-publish-readiness-modal .modal-title,
  .publish-readiness-summary,
  .publish-history-compact,
  .agent-publish-readiness-modal .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .publish-readiness-list {
    padding-left: 16px;
    padding-right: 16px;
  }

  .publish-readiness-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.modal-title h2 {
  min-width: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.modal-close {
  width: 34px;
  height: 34px;
  color: #8b91a0;
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
}

.basic-form {
  display: grid;
  gap: 18px;
  padding: 20px 28px 28px;
}

.basic-form label {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: start;
  gap: 14px;
}

.basic-form em {
  color: #ff3b30;
  font-style: normal;
}

.avatar-desc-line {
  grid-template-columns: 130px 150px minmax(0, 1fr) !important;
  grid-template-rows: auto auto;
}

.avatar-upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.avatar-upload input[type="text"] { flex: 1; min-width: 180px; }

.avatar-desc-line > span {
  grid-row: 1 / span 2;
}

.avatar-desc-line > textarea {
  grid-column: 3;
}

.agent-cover-preview-card {
  grid-row: 1 / span 2;
  width: 150px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.agent-cover-preview-frame {
  width: 150px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #f3f5fa;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.agent-cover-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.agent-cover-preview-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
  color: #8d93a2;
  text-align: center;
  font-size: 13px;
}

.agent-cover-preview-card strong {
  font-size: 13px;
  color: #1f2a44;
}

.agent-cover-preview-card strong[data-state="uploaded"],
.agent-cover-preview-card strong[data-state="ready"] {
  color: #148a42;
}

.agent-cover-preview-card strong[data-state="failed"] {
  color: #c52b2b;
}

.agent-cover-preview-card small {
  color: #8d93a2;
  line-height: 1.4;
  word-break: break-all;
}
.avatar-old {
  height: 120px;
  display: grid;
  place-items: center;
  align-content: center;
  color: #8d93a2;
  background: #f3f5fa;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.avatar-upload input[type="file"] {
  width: 100%;
  height: 0;
  opacity: 0;
  padding: 0;
  border: 0;
}

.avatar-upload strong {
  font-size: 28px;
  font-weight: 300;
}

.basic-form textarea {
  min-height: 120px;
}

.model-config-dialog .model-edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 22px 24px;
}

.model-config-dialog #modelEditId {
  display: none;
}

.model-config-dialog .model-form-side {
  display: grid;
  gap: 14px;
}

.model-config-dialog .model-form-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.model-config-dialog .model-form-section h3 {
  margin: 0 0 2px;
  font-size: 14px;
  color: #111827;
}

.model-config-dialog .model-form-section label {
  display: grid;
  grid-template-columns: minmax(148px, 188px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: #374151;
  font-size: 13px;
}

.model-config-dialog .model-form-section input,
.model-config-dialog .model-form-section select {
  width: 100%;
}

.model-config-dialog .model-form-section .check-line {
  grid-template-columns: auto 1fr;
  justify-content: start;
}

.model-config-dialog .model-form-advanced {
  background: #ffffff;
}

.model-config-dialog .model-form-advanced summary {
  display: grid;
  gap: 4px;
  cursor: pointer;
  color: #111827;
  font-weight: 700;
}

.model-config-dialog .model-form-advanced summary small,
.model-config-dialog .model-form-note {
  color: #6b7280;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.model-config-dialog .model-form-note {
  margin: 0;
}

@media (max-width: 860px) {
  .model-config-dialog .model-edit-form {
    grid-template-columns: 1fr;
  }
  .model-config-dialog .model-form-section label {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px 24px;
}

.modal-actions button {
  max-width: 100%;
}

.modal-actions.split-actions {
  justify-content: space-between;
}

.left-actions {
  justify-content: flex-start;
  padding-left: 24px;
}

.knowledge-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: 1 1 auto;
  min-width: 0;
}

.knowledge-modal-fixed-head {
  flex: 0 0 auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

#knowledgeModal .modal-title {
  height: auto;
  min-height: 62px;
  gap: 14px;
  padding: 12px 20px 8px 24px;
  border-bottom: 0;
}

.knowledge-title-main {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.knowledge-title-main h2 {
  flex: 0 0 auto;
}

#knowledgeModal .knowledge-modal-toolbar .search-box {
  flex: 0 1 360px;
  min-width: 260px;
}

.knowledge-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px 0 16px;
}

#knowledgeModal .knowledge-upload-guidance {
  margin: 0 24px 12px;
  padding: 8px 10px;
  gap: 2px;
  font-size: 12px;
  line-height: 1.45;
}

#knowledgeModal .modal-actions {
  flex: 0 0 auto;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.knowledge-scope-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.knowledge-scope-filters select {
  min-width: 150px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

.knowledge-scope-filters select.is-invisible {
  visibility: hidden;
  pointer-events: none;
}

.new-kb-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 24px 18px;
}

.new-kb-form .primary-button {
  justify-self: start;
  min-width: 120px;
}

.knowledge-picker-table {
  margin: 0 24px;
  display: grid;
  gap: 12px;
}

.table-head,
.picker-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 260px;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}

.table-head {
  background: #f6f7fb;
}

.picker-row {
  border-top: 1px solid var(--line);
}

.picker-row input {
  width: 16px;
  height: 16px;
}

.picker-row {
  grid-template-columns: 24px 1.2fr 1fr 260px;
}

.picker-kb-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.picker-kb-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
  align-items: start;
  gap: 18px;
  padding: 16px 18px;
  background: #fff;
}

.picker-kb-main {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.picker-kb-main strong,
.picker-kb-main span,
.picker-kb-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-kb-main span,
.picker-kb-main small {
  color: var(--muted);
}

.picker-row em,
.picker-file-row em {
  color: var(--blue);
  font-style: normal;
}

.picker-row em {
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-kb-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.picker-kb-actions .table-link {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 8px;
  white-space: nowrap;
}

.picker-file-list {
  border-top: 1px solid var(--line);
  background: #fbfcff;
}

.picker-file-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 180px;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 12px 44px;
  cursor: pointer;
}

.picker-file-row.has-preview {
  grid-template-columns: 24px minmax(0, 1fr) 170px 84px;
}

.picker-file-row + .picker-file-row {
  border-top: 1px solid #eef1f7;
}

.picker-file-row.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.picker-file-row input {
  width: 16px;
  height: 16px;
}

.picker-file-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-file-row em {
  color: var(--muted);
  text-align: right;
}

.picker-file-row .table-link {
  justify-self: end;
  white-space: nowrap;
}

.picker-file-empty {
  padding: 12px 20px 12px 44px;
  color: var(--muted);
  background: #fbfcff;
  border-top: 1px solid var(--line);
}

@media (max-width: 1180px) {
  .picker-kb-row {
    grid-template-columns: 1fr;
  }

  .picker-kb-actions {
    justify-content: flex-start;
  }
}

.knowledge-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.knowledge-detail-head > div:first-child {
  display: grid;
  gap: 6px;
}

.knowledge-detail-head span {
  color: var(--muted);
}

.knowledge-detail-head > div:last-child {
  display: flex;
  gap: 10px;
}

.kb-file-row {
  grid-template-columns: 1.25fr 1fr 260px;
}

.knowledge-file-preview-card {
  width: min(980px, calc(100vw - 80px));
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.knowledge-file-preview-body {
  padding: 20px 24px 0;
  overflow: auto;
}

.knowledge-file-preview-meta {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.knowledge-file-preview-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-file-preview-meta-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.knowledge-file-preview-meta-grid span,
.knowledge-file-preview-meta p {
  color: var(--muted);
}

.knowledge-file-preview-meta-grid strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-file-preview-meta p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.knowledge-chunk-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.knowledge-chunk-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.knowledge-chunk-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #f6f7fb;
  border-bottom: 1px solid var(--line);
}

.knowledge-chunk-card header span {
  color: var(--muted);
  font-size: 12px;
}

.knowledge-chunk-card pre {
  max-height: 260px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #202638;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.service-modal-card {
  padding-bottom: 34px;
}

.service-modal-card > label {
  grid-template-columns: 120px 360px;
  align-items: center;
  margin: 26px 80px 0;
}

.qr-upload {
  width: 140px;
  height: 140px;
  display: grid;
  place-items: center;
  margin: 26px 0 0 198px;
  color: #8d93a2;
  border: 1px dashed #d5dae6;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
}

.qr-upload input {
  width: 100%;
  height: 0;
  opacity: 0;
  padding: 0;
  border: 0;
}

.qr-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #fff;
}

@media (max-width: 1100px) {
  .chat-bg-preview-grid {
    grid-template-columns: 1fr;
  }

  .chat-bg-web-preview,
  .chat-bg-mobile-preview {
    min-height: 360px;
  }

  .chat-bg-mobile-preview {
    width: 100%;
    max-width: none;
  }

  .service-modal-card > label {
    grid-template-columns: 1fr;
    margin: 18px 24px 0;
  }

  .qr-upload {
    margin: 18px 24px 0;
  }
}

@media (max-width: 1439px) {
  .agent-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1199px) {
  .agent-card-grid {
    grid-template-columns: 1fr;
  }
}
#dataPage > .simple-editor-card {
  display: none;
}

.memory-admin-panel {
  height: 100%;
  padding: 16px 18px 18px;
  overflow: hidden;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.95fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px 16px;
}

.memory-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 0;
  grid-column: 1;
  grid-row: 1;
}

.memory-admin-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #111827;
}

.memory-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 0;
  grid-column: 1;
  grid-row: 2;
}

.memory-stat-grid div {
  padding: 10px 12px;
  border: 1px solid #e6e8f0;
  background: #f8f9fc;
  border-radius: 8px;
}

.memory-stat-grid strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
  color: #111827;
}

.memory-stat-grid span {
  color: #7d8798;
  font-size: 13px;
}

.memory-layout {
  display: contents;
}

.memory-layout .memory-list {
  grid-column: 1;
  grid-row: 4;
  min-height: 0;
}

.memory-layout .memory-thread {
  grid-column: 2;
  grid-row: 1 / 5;
  min-height: 0;
}

.memory-filter-bar {
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.memory-filter-bar input {
  width: 100%;
  min-width: 0;
}

.memory-filter-bar span {
  min-width: 96px;
  color: #8a94a6;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.memory-list,
.memory-thread {
  min-height: 0;
  overflow: auto;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.memory-item {
  padding: 16px;
  border-bottom: 1px solid #edf0f5;
  cursor: default;
}

.memory-item.active {
  background: #eef5ff;
  box-shadow: inset 3px 0 0 #2338ff;
}

.memory-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.memory-item-head strong {
  font-size: 15px;
  color: #111827;
}

.memory-item-head span,
.memory-thread-head span,
.memory-meta {
  font-size: 12px;
  color: #8a94a6;
}

.memory-summary-preview {
  margin: 0 0 12px;
  color: #4b5565;
  line-height: 1.6;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.memory-actions {
  display: flex;
  gap: 14px;
}

.memory-thread-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8f9fc;
  border-bottom: 1px solid #e6e8f0;
}

.memory-message-list {
  padding: 16px;
}

.memory-message {
  margin-bottom: 14px;
  max-width: 88%;
}

.memory-message.user {
  margin-left: auto;
  text-align: right;
}

.memory-message strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: #8a94a6;
}

.memory-message p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.6;
  font-size: 13px;
  white-space: pre-wrap;
  text-align: left;
  background: #f2f4f8;
}

.memory-message.user p {
  color: #fff;
  background: #2338ff;
}

.empty-memory {
  padding: 30px;
  color: #8a94a6;
  text-align: center;
}

.users-panel {
  height: 100%;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  display: flex;
  flex-direction: column;
}

.users-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.users-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.agent-users-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
}

.agent-users-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.agent-users-table th,
.agent-users-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.agent-users-table th {
  color: #6b7280;
  background: #f8f9fc;
  font-weight: 700;
}

.agent-users-table td strong,
.agent-users-table td span {
  display: block;
}

.agent-users-table td span {
  margin-top: 4px;
  color: #8a94a6;
  font-size: 12px;
}

.memory-modal-card {
  width: min(760px, calc(100vw - 80px));
}

.memory-modal-card textarea {
  width: 100%;
  height: 360px;
  resize: none;
  border: 1px solid #dce2ee;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.7;
  font-size: 14px;
 outline: none;
 background: #f8f9fc;
}

.conversation-admin-panel {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: 18px 20px;
  overflow: hidden;
  background: #fff;
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px 16px;
}

.conversation-admin-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.conversation-admin-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #111827;
}

.conversation-admin-head p {
  margin: 0;
  font-size: 13px;
  color: #7d8798;
}

.conversation-toolbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 130px 150px 170px 160px minmax(220px, 1fr) 88px 88px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.conversation-toolbar select,
.conversation-toolbar input {
  width: 100%;
  height: 38px;
  min-width: 0;
}

.conversation-toolbar select:disabled {
  color: #8a94a6;
  background: #eef1f6;
}

.conversation-filter-hints {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.conversation-filter-hints span {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 9px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  color: #6b7280;
  background: #eef2f7;
  font-size: 12px;
  line-height: 1;
}

.conversation-stat-grid {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(190px, 1.25fr);
  gap: 10px;
  align-items: stretch;
}

.conversation-stat-grid div {
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid #e6e8f0;
  background: #f8f9fc;
  border-radius: 8px;
}

.conversation-stat-grid strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  color: #111827;
}

.conversation-stat-grid .nowrap-time {
  font-size: 14px;
  white-space: nowrap;
  letter-spacing: 0;
}

.conversation-stat-grid span {
  color: #7d8798;
  font-size: 12px;
}

.conversation-layout {
  display: contents;
}

.conversation-thread-list,
.conversation-detail {
  min-height: 0;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.conversation-thread-list {
  grid-column: 1;
  grid-row: 3;
  overflow-y: auto;
}

.conversation-thread-item {
  padding: 14px 16px;
  border-bottom: 1px solid #edf0f5;
  cursor: pointer;
}

.conversation-thread-item.active {
  background: #eef5ff;
  box-shadow: inset 3px 0 0 #2338ff;
}

.conversation-thread-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.conversation-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  background: #edf0f5;
}

.conversation-avatar img,
.conversation-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.conversation-avatar img {
  display: block;
  object-fit: cover;
}

.conversation-avatar img.hidden {
  display: none;
}

.conversation-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #526070;
  background: #edf0f5;
  font-weight: 700;
  font-size: 13px;
}

.conversation-avatar-fallback.hidden {
  display: none;
}

.conversation-thread-title strong {
  display: block;
  font-size: 14px;
  color: #111827;
}

.conversation-thread-title span,
.conversation-thread-meta {
  font-size: 12px;
  color: #8a94a6;
}

.conversation-thread-item p {
  margin: 0 0 10px;
  color: #4b5565;
  line-height: 1.5;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conversation-thread-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.conversation-thread-tags span {
  padding: 2px 7px;
  color: #2338ff;
  background: #eef5ff;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
}

.conversation-thread-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.conversation-detail {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conversation-detail-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8f9fc;
  border-bottom: 1px solid #e6e8f0;
}

.conversation-detail-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.conversation-detail-tools .ghost-button {
  height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.conversation-detail-head strong {
  display: block;
  margin-bottom: 4px;
  color: #111827;
  font-size: 15px;
}

.conversation-detail-head span {
  font-size: 12px;
  color: #8a94a6;
}

.internal-id-muted {
  color: #98a2b3;
  font-size: 12px;
  font-weight: 500;
}

.conversation-message-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.conversation-message {
  margin-bottom: 14px;
  max-width: 84%;
}

.conversation-message.user {
  margin-left: auto;
  text-align: right;
}

.conversation-message strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: #8a94a6;
}

.conversation-message-content {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.6;
  font-size: 13px;
  text-align: left;
  background: #f2f4f8;
  overflow-wrap: anywhere;
}

.conversation-message.user .conversation-message-content {
  color: #fff;
  background: #2338ff;
}

.conversation-message-content > :first-child {
  margin-top: 0;
}

.conversation-message-content > :last-child {
  margin-bottom: 0;
}

.conversation-message-content h1,
.conversation-message-content h2,
.conversation-message-content h3 {
  margin: 12px 0 6px;
  color: inherit;
  font-size: 15px;
  line-height: 1.45;
}

.conversation-message-content p,
.conversation-message-content ul,
.conversation-message-content ol,
.conversation-message-content pre {
  margin: 6px 0;
}

.conversation-message-content ul,
.conversation-message-content ol {
  padding-left: 22px;
}

.conversation-message-content hr {
  margin: 10px 0;
  border: 0;
  border-top: 1px solid #d8dee9;
}

.conversation-message-content code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.08);
  font-family: Consolas, "SFMono-Regular", monospace;
}

.conversation-message-content pre {
  overflow-x: auto;
  padding: 9px 10px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.07);
  white-space: pre-wrap;
}

.conversation-message-content pre code {
  padding: 0;
  background: transparent;
}

.conversation-attachments {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  justify-content: flex-start;
}

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

.conversation-attachments span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef5ff;
  color: #2338ff;
  font-size: 12px;
}

/* ===== Analytics Dashboard ===== */
.analytics-admin-panel {
  min-height: 100%;
  box-sizing: border-box;
  padding: 18px 20px;
  overflow-x: hidden;
  overflow-y: visible;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analytics-shell-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(460px, 0.95fr);
  gap: 14px;
}

.analytics-left-column {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 10px;
}

.analytics-right-column {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
}

.analytics-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.analytics-admin-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: #111827;
}

.analytics-admin-head p {
  margin: 0;
  font-size: 13px;
  color: #7d8798;
}

.analytics-toolbar {
  order: 1;
  display: grid;
  grid-template-columns: 130px 170px 170px minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.analytics-toolbar select {
  width: 100%;
  height: 32px;
}

.analytics-stat-grid {
  order: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.analytics-stat-grid div {
  padding: 9px 11px;
  border: 1px solid #e6e8f0;
  background: #f8f9fc;
  border-radius: 8px;
}

.analytics-stat-grid strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
  color: #111827;
}

.analytics-stat-grid span {
  color: #7d8798;
  font-size: 12px;
}

.analytics-card {
  min-height: 240px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.analytics-card-head {
  flex: 0 0 auto;
  padding: 11px 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #f8f9fc;
  border-bottom: 1px solid #e6e8f0;
}

.analytics-card-head h4 {
  margin: 0;
  font-size: 15px;
  color: #111827;
}

.analytics-card-head span {
  display: block;
  margin-top: 2px;
  color: #8a94a6;
  font-size: 12px;
}

.analytics-agent-card,
.analytics-trend-card,
.analytics-tenant-card {
  min-height: 0;
}

.analytics-grid {
  order: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.analytics-tenant-card {
  min-height: 0;
}

.analytics-refresh-button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 16px;
}

.analytics-table-scroll,
.analytics-trend-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
}

.analytics-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.analytics-tenant-table {
  min-width: 820px;
  table-layout: fixed;
}

.analytics-agent-table {
  min-width: 820px;
  table-layout: fixed;
}

.analytics-miniapp-table {
  min-width: 820px;
  table-layout: fixed;
}

.analytics-ai-table {
  min-width: 760px;
  table-layout: fixed;
}

.tenant-performance-card {
  order: 3;
  height: 720px;
  min-height: 720px;
  max-height: 720px;
  overflow: hidden;
}

.tenant-performance-head {
  align-items: center;
}

.tenant-performance-actions,
.tenant-performance-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tenant-performance-actions {
  flex: 0 0 auto;
}

.tenant-performance-actions button {
  min-height: 34px;
  white-space: nowrap;
}

.tenant-performance-toolbar {
  padding: 10px 13px;
  border-bottom: 1px solid #e6e8f0;
  background: #fff;
}

.tenant-performance-toolbar select {
  width: 150px;
  height: 32px;
}

.tenant-performance-toolbar button {
  height: 32px;
  padding: 0 16px;
}

.tenant-performance-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 13px;
  border-bottom: 1px solid #eef0f5;
  background: #fbfcff;
}

.tenant-performance-stat-grid div {
  padding: 9px 10px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.tenant-performance-stat-grid strong {
  display: block;
  font-size: 16px;
  color: #111827;
  line-height: 1.2;
}

.tenant-performance-stat-grid span {
  color: #7d8798;
  font-size: 12px;
}

.tenant-performance-table-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tenant-performance-summary-section,
.tenant-performance-detail-section {
  flex: 1 1 0;
  margin-right: 13px;
  margin-left: 13px;
  border: 1px solid;
  border-radius: 8px;
}

.tenant-performance-summary-section {
  margin-top: 10px;
  border-color: #d6e2ff;
  background: #f7f9ff;
}

.tenant-performance-detail-section {
  margin-top: 10px;
  margin-bottom: 10px;
  border-color: #dfe4ec;
  background: #fbfcfe;
}

.tenant-performance-summary-section .analytics-subsection-head {
  background: #eef3ff;
  border-bottom-color: #d6e2ff;
}

.tenant-performance-detail-section .analytics-subsection-head {
  background: #f4f6fa;
  border-bottom-color: #dfe4ec;
}

.analytics-subsection-head {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
  background: #fff;
  border-bottom: 1px solid #eef0f5;
}

.analytics-subsection-head h5 {
  margin: 0;
  color: #344054;
  font-size: 13px;
}

.tenant-performance-summary-scroll {
  flex: 1 1 auto;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.tenant-performance-detail-scroll {
  flex: 1 1 auto;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.tenant-performance-table {
  min-width: 0;
  width: 100%;
}

.tenant-performance-pending {
  display: inline-flex;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  color: #8a5a00;
  background: #fff7df;
}

.tenant-performance-note {
  margin: 0;
  padding: 9px 13px;
  color: #7d8798;
  font-size: 12px;
  border-top: 1px solid #eef0f5;
}

.analytics-table th,
.analytics-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #eef0f5;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.analytics-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #7d8798;
  font-weight: 600;
  background: #fbfcff;
  box-shadow: inset 0 -1px 0 #eef0f5;
}

.analytics-table td strong {
  display: block;
  color: #111827;
  font-size: 13px;
}

.analytics-table td span {
  display: block;
  margin-top: 3px;
  color: #99a1b0;
  font-size: 12px;
}

.analytics-trend-list {
  padding: 12px 14px;
}

.analytics-dimension-card {
  order: 4;
  height: 370px;
  min-height: 370px;
  max-height: 370px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.analytics-dimension-head {
  min-height: 54px;
}

.analytics-dimension-tabs {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 13px;
  display: flex;
  align-items: end;
  gap: 22px;
  overflow-x: auto;
  border-bottom: 1px solid #e6e8f0;
  background: #fff;
}

.analytics-dimension-tabs button {
  min-height: 42px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #667085;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.analytics-dimension-tabs button:hover,
.analytics-dimension-tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.analytics-dimension-tabs button:focus-visible,
.analytics-dimension-panel tbody tr:focus-visible,
.text-button:focus-visible {
  outline: 2px solid #7b8cff;
  outline-offset: 2px;
}

.analytics-dimension-panels,
.analytics-dimension-panel {
  flex: 1 1 auto;
  min-height: 0;
}

.analytics-dimension-panels {
  display: flex;
  overflow: hidden;
}

.analytics-dimension-panel {
  width: 100%;
  overflow: hidden;
}

.analytics-dimension-panel[hidden] {
  display: none;
}

.analytics-dimension-panel .analytics-table-scroll,
.analytics-dimension-panel .analytics-mini-summary {
  height: 100%;
  max-height: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.analytics-dimension-panel .analytics-table {
  table-layout: fixed;
}

.analytics-dimension-panel .analytics-table th {
  text-align: center;
}

.analytics-dimension-panel .analytics-table td {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.analytics-agent-table th:nth-child(1) { width: 21%; }
.analytics-agent-table th:nth-child(2) { width: 10%; }
.analytics-agent-table th:nth-child(3) { width: 16%; }
.analytics-agent-table th:nth-child(4) { width: 9%; }
.analytics-agent-table th:nth-child(5) { width: 8%; }
.analytics-agent-table th:nth-child(6) { width: 10%; }
.analytics-agent-table th:nth-child(7) { width: 8%; }
.analytics-agent-table th:nth-child(8) { width: 18%; }

.analytics-tenant-table th:nth-child(1) { width: 13%; }
.analytics-tenant-table th:nth-child(2) { width: 14%; }
.analytics-tenant-table th:nth-child(3) { width: 8%; }
.analytics-tenant-table th:nth-child(4) { width: 8%; }
.analytics-tenant-table th:nth-child(5) { width: 8%; }
.analytics-tenant-table th:nth-child(6) { width: 10%; }
.analytics-tenant-table th:nth-child(7) { width: 8%; }
.analytics-tenant-table th:nth-child(8) { width: 14%; }
.analytics-tenant-table th:nth-child(9) { width: 17%; }

.analytics-miniapp-table th:nth-child(1) { width: 18%; }
.analytics-miniapp-table th:nth-child(2) { width: 12%; }
.analytics-miniapp-table th:nth-child(3) { width: 9%; }
.analytics-miniapp-table th:nth-child(4) { width: 9%; }
.analytics-miniapp-table th:nth-child(5) { width: 8%; }
.analytics-miniapp-table th:nth-child(6) { width: 8%; }
.analytics-miniapp-table th:nth-child(7) { width: 10%; }
.analytics-miniapp-table th:nth-child(8) { width: 8%; }
.analytics-miniapp-table th:nth-child(9) { width: 18%; }

.analytics-ai-table th:nth-child(1) { width: 14%; }
.analytics-ai-table th:nth-child(2) { width: 22%; }
.analytics-ai-table th:nth-child(3) { width: 14%; }
.analytics-ai-table th:nth-child(4) { width: 20%; }
.analytics-ai-table th:nth-child(5) { width: 9%; }
.analytics-ai-table th:nth-child(6) { width: 12%; }
.analytics-ai-table th:nth-child(7) { width: 9%; }

.analytics-agent-table td:nth-child(-n + 3),
.analytics-tenant-table td:nth-child(-n + 2),
.analytics-miniapp-table td:nth-child(1),
.analytics-ai-table td:nth-child(-n + 4) {
  padding-left: 18px;
  text-align: left;
}

.analytics-dimension-panel tbody tr[role="button"] {
  cursor: pointer;
}

.analytics-dimension-panel tbody tr[role="button"]:hover {
  background: #f7f9ff;
}

.analytics-trend-card {
  order: 5;
  height: 300px;
  min-height: 300px;
  max-height: 300px;
  overflow: hidden;
}

.analytics-trend-card .analytics-trend-list {
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.tenant-performance-summary-scroll,
.tenant-performance-detail-scroll,
.analytics-dimension-panel .analytics-table-scroll,
.analytics-dimension-panel .analytics-mini-summary,
.analytics-trend-card .analytics-trend-list {
  scrollbar-width: thin;
  scrollbar-color: #aeb7c7 #eef1f6;
}

.tenant-performance-summary-scroll::-webkit-scrollbar,
.tenant-performance-detail-scroll::-webkit-scrollbar,
.analytics-dimension-panel .analytics-table-scroll::-webkit-scrollbar,
.analytics-dimension-panel .analytics-mini-summary::-webkit-scrollbar,
.analytics-trend-card .analytics-trend-list::-webkit-scrollbar {
  width: 8px;
}

.tenant-performance-summary-scroll::-webkit-scrollbar-track,
.tenant-performance-detail-scroll::-webkit-scrollbar-track,
.analytics-dimension-panel .analytics-table-scroll::-webkit-scrollbar-track,
.analytics-dimension-panel .analytics-mini-summary::-webkit-scrollbar-track,
.analytics-trend-card .analytics-trend-list::-webkit-scrollbar-track {
  background: #eef1f6;
}

.tenant-performance-summary-scroll::-webkit-scrollbar-thumb,
.tenant-performance-detail-scroll::-webkit-scrollbar-thumb,
.analytics-dimension-panel .analytics-table-scroll::-webkit-scrollbar-thumb,
.analytics-dimension-panel .analytics-mini-summary::-webkit-scrollbar-thumb,
.analytics-trend-card .analytics-trend-list::-webkit-scrollbar-thumb {
  border: 2px solid #eef1f6;
  border-radius: 8px;
  background: #aeb7c7;
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.text-button:hover {
  background: #eef2ff;
}

.analytics-module-state {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-items: center;
  color: #9aa2b1;
}

.analytics-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  justify-content: flex-end;
  background: rgba(17, 24, 39, 0.42);
}

.analytics-drawer {
  width: min(1120px, calc(100vw - 32px));
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -18px 0 48px rgba(17, 24, 39, 0.18);
}

.analytics-drawer-head {
  flex: 0 0 auto;
  min-height: 68px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e6e8f0;
  box-sizing: border-box;
}

.analytics-drawer-head h3 {
  margin: 0;
  color: #111827;
  font-size: 18px;
}

.analytics-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 16px 18px;
  box-sizing: border-box;
}

.analytics-drawer-table-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
}

.analytics-drawer-summary {
  height: 100%;
  overflow-y: auto;
}

.analytics-row-details {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.analytics-row-details div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.analytics-row-details dt {
  color: #7d8798;
  font-size: 12px;
}

.analytics-row-details dd {
  margin: 5px 0 0;
  color: #111827;
  overflow-wrap: anywhere;
}

.analytics-trend-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 76px;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  color: #6b7280;
  font-size: 12px;
}

.analytics-trend-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #edf1f8;
}

.analytics-trend-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
}

.analytics-trend-row strong {
  text-align: right;
  color: #111827;
  font-size: 12px;
}

.analytics-empty {
  padding: 18px;
  color: #9aa2b1;
  text-align: center;
}

.analytics-mini-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.analytics-mini-summary div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #eef0f5;
  border-radius: 8px;
  background: #fbfcff;
}

.analytics-mini-summary span {
  display: block;
  color: #7d8798;
  font-size: 12px;
  line-height: 1.3;
}

.analytics-mini-summary strong {
  display: block;
  margin-top: 4px;
  color: #111827;
  font-size: 15px;
}

.analytics-mini-summary p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #667085;
  background: #f8f9fc;
  font-size: 12px;
  line-height: 1.5;
}

.analytics-empty-note {
  border: 1px solid #eef1f6;
  color: #7d8798;
  background: #f8f9fc;
  text-align: center;
}

[data-analytics-dimension-panel="lead"] .analytics-mini-summary {
  gap: 8px;
  padding: 10px 12px;
  overflow-y: auto;
  scrollbar-gutter: auto;
}

[data-analytics-dimension-panel="lead"] .analytics-mini-summary div {
  padding: 8px 10px;
}

[data-analytics-dimension-panel="lead"] .analytics-empty-note {
  padding: 6px 10px;
}

[data-analytics-dimension-panel="recharge"] .analytics-mini-summary {
  overflow-y: auto;
  scrollbar-gutter: auto;
}

@media (min-width: 1280px) {
  .analytics-recharge-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    padding: 10px 12px;
  }

  .analytics-recharge-summary div {
    padding: 8px 10px;
  }
}

@media (max-width: 1280px) {
  .analytics-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .analytics-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tenant-performance-toolbar {
    align-content: flex-start;
    max-height: 92px;
    overflow-y: auto;
  }

  .tenant-performance-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ===== Finance Compute ===== */
.finance-admin-panel {
  min-height: 100%;
  box-sizing: border-box;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: visible;
  background: #fff;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.finance-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.finance-admin-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #111827;
}

.finance-admin-head p {
  margin: 0;
  font-size: 13px;
  color: #7d8798;
}

.finance-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) 88px 88px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.finance-toolbar select,
.finance-toolbar input {
  width: 100%;
  height: 38px;
}

.finance-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.finance-stat-grid div {
  padding: 12px 14px;
  border: 1px solid #e6e8f0;
  background: #f8f9fc;
  border-radius: 8px;
}

.finance-stat-grid strong {
  display: block;
  overflow: hidden;
  font-size: clamp(15px, 1.1vw, 18px);
  line-height: 1.2;
  color: #111827;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-stat-grid span {
  color: #7d8798;
  font-size: 12px;
}

.finance-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
  overflow-x: hidden;
}

.finance-tab {
  min-width: 92px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #536176;
  cursor: pointer;
  font-weight: 600;
}

.finance-tab.active {
  background: #fff;
  border-color: #dfe4ef;
  color: #1f32ff;
}

.analytics-dimension-tabs.finance-tabs {
  flex-wrap: nowrap;
  flex: 0 0 auto;
  min-height: 46px;
  margin: 0 14px 8px;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
}

.analytics-dimension-tab.finance-tab {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #536176;
  font-size: 14px;
  font-weight: 600;
}

.analytics-dimension-tab.finance-tab:hover {
  border-color: #dfe4ef;
  background: #fff;
  color: #1f32ff;
}

.analytics-dimension-tab.finance-tab.active {
  border-color: #dfe4ef;
  border-bottom-color: #dfe4ef;
  background: #fff;
  color: #1f32ff;
}

.finance-tab-panel.hidden {
  display: none;
}

.finance-tab-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

.finance-layout {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  grid-template-rows: auto;
  gap: 14px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.finance-left-stack {
  min-height: 0;
  display: block;
  min-width: 0;
}

.finance-wallet-card {
  height: 420px;
}

.finance-usage-card {
  height: 420px;
  min-height: 0;
}

.finance-card {
  min-height: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.finance-card-head {
  flex: 0 0 auto;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fc;
  border-bottom: 1px solid #e6e8f0;
}

.finance-card-head h4 {
  margin: 0;
  font-size: 15px;
  color: #111827;
}

.finance-card-head span {
  color: #8a94a6;
  font-size: 12px;
}

.finance-table-scroll {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

.finance-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.finance-wallet-card .finance-table {
  min-width: 0;
}

.finance-ledger-card .finance-table {
  min-width: 0;
}

.finance-usage-card .finance-table {
  min-width: 0;
}

.finance-rights-table {
  min-width: 0;
}

.finance-rights-table th:nth-child(1),
.finance-rights-table td:nth-child(1) {
  width: 18%;
}

.finance-rights-table th:nth-child(2),
.finance-rights-table td:nth-child(2) {
  width: 14%;
}

.finance-rights-table th:nth-child(3),
.finance-rights-table td:nth-child(3) {
  width: 13%;
}

.finance-rights-table th:nth-child(4),
.finance-rights-table td:nth-child(4),
.finance-rights-table th:nth-child(5),
.finance-rights-table td:nth-child(5) {
  width: 13%;
}

.finance-rights-table th:nth-child(6),
.finance-rights-table td:nth-child(6) {
  width: 15%;
  white-space: nowrap;
}

.finance-rights-table th:nth-child(7),
.finance-rights-table td:nth-child(7) {
  width: 14%;
}

.finance-ledger-table {
  min-width: 0;
}

.finance-ledger-table th:nth-child(2),
.finance-ledger-table td:nth-child(2) {
  width: 128px;
  white-space: nowrap;
  word-break: normal;
}

.finance-ledger-table th:nth-child(1),
.finance-ledger-table td:nth-child(1) {
  width: 132px;
  white-space: nowrap;
}

.finance-ledger-table th:nth-child(3),
.finance-ledger-table td:nth-child(3) {
  width: 108px;
}

.finance-ledger-table th:nth-child(4),
.finance-ledger-table td:nth-child(4) {
  width: 118px;
}

.finance-ledger-table th:nth-child(5),
.finance-ledger-table td:nth-child(5),
.finance-ledger-table th:nth-child(6),
.finance-ledger-table td:nth-child(6),
.finance-ledger-table th:nth-child(7),
.finance-ledger-table td:nth-child(7) {
  width: 98px;
}

.finance-ledger-table th:nth-child(9),
.finance-ledger-table td:nth-child(9) {
  width: 72px;
}

.finance-ai-usage-table {
  min-width: 980px;
}

.finance-ai-usage-table th:nth-child(1),
.finance-ai-usage-table td:nth-child(1) {
  width: 128px;
  white-space: nowrap;
}

.finance-ai-usage-table th:nth-child(2),
.finance-ai-usage-table td:nth-child(2) {
  width: 110px;
}

.finance-ai-usage-table th:nth-child(3),
.finance-ai-usage-table td:nth-child(3) {
  width: 100px;
}

.finance-ai-usage-table th:nth-child(4),
.finance-ai-usage-table td:nth-child(4),
.finance-ai-usage-table th:nth-child(5),
.finance-ai-usage-table td:nth-child(5) {
  width: 110px;
}

.finance-ai-usage-table th:nth-child(6),
.finance-ai-usage-table td:nth-child(6) {
  width: 82px;
  white-space: nowrap;
}

.finance-ai-usage-table th:nth-child(8),
.finance-ai-usage-table td:nth-child(8) {
  width: 72px;
}

.finance-ai-usage-table th:nth-child(9),
.finance-ai-usage-table td:nth-child(9) {
  width: 64px;
}

.finance-ai-usage-table td:nth-child(7) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.finance-package-table {
  min-width: 0;
  table-layout: fixed;
}

.finance-package-table th:nth-child(1),
.finance-package-table td:nth-child(1) {
  width: 14%;
}

.finance-package-table th:nth-child(2),
.finance-package-table td:nth-child(2),
.finance-package-table th:nth-child(3),
.finance-package-table td:nth-child(3),
.finance-package-table th:nth-child(9),
.finance-package-table td:nth-child(9),
.finance-package-table th:nth-child(11),
.finance-package-table td:nth-child(11),
.finance-package-table th:nth-child(12),
.finance-package-table td:nth-child(12) {
  width: 5%;
}

.finance-package-table th:nth-child(4),
.finance-package-table td:nth-child(4),
.finance-package-table th:nth-child(5),
.finance-package-table td:nth-child(5),
.finance-package-table th:nth-child(6),
.finance-package-table td:nth-child(6),
.finance-package-table th:nth-child(7),
.finance-package-table td:nth-child(7),
.finance-package-table th:nth-child(8),
.finance-package-table td:nth-child(8),
.finance-package-table th:nth-child(10),
.finance-package-table td:nth-child(10) {
  width: 6%;
}

.finance-package-table th:nth-child(13),
.finance-package-table td:nth-child(13) {
  width: 20%;
}

.finance-table th,
.finance-table td {
  padding: 8px 7px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: top;
  color: #374151;
  min-width: 0;
}

.finance-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  color: #7d8798;
  font-weight: 600;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  line-height: 1.16;
  word-break: keep-all;
}

.finance-table td {
  line-height: 1.32;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.finance-table td strong {
  display: block;
  color: #111827;
}

.finance-table td span {
  display: block;
  margin-top: 3px;
  color: #9aa3b2;
  font-size: 12px;
}

.finance-usage-card .finance-table td:last-child,
.finance-ledger-card .finance-table td:last-child {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-strong {
  font-weight: 700;
  color: #111827 !important;
}

.finance-positive {
  color: #059669 !important;
  font-weight: 700;
}

.finance-negative {
  color: #dc2626 !important;
  font-weight: 700;
}

.finance-empty {
  text-align: center !important;
  padding: 28px 12px !important;
  color: #9aa3b2 !important;
}

.finance-actions {
  white-space: normal;
}

.finance-actions button {
  margin: 0 6px 6px 0;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #dbe1ee;
  border-radius: 6px;
  background: #fff;
  color: #31415a;
  cursor: pointer;
  white-space: nowrap;
}

.finance-actions button:hover {
  border-color: #3246ff;
  color: #1f32ff;
}

.finance-package-actions-cell {
  min-width: 190px;
  white-space: nowrap;
}

.finance-package-actions-cell .finance-action-button {
  margin: 0 6px 0 0;
}

.finance-action-button {
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 28px;
}

.finance-action-blue {
  border-color: #2563eb !important;
  background: #2563eb !important;
  color: #fff !important;
}

.finance-action-soft {
  border-color: #bfdbfe !important;
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

.finance-action-danger {
  border-color: #dc2626 !important;
  background: #dc2626 !important;
  color: #fff !important;
}

.finance-action-blue:hover,
.finance-action-soft:hover,
.finance-action-danger:hover {
  filter: brightness(.96);
}

.finance-package-form {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #e6e8f0;
  background: #fff;
}

.finance-package-section {
  padding: 12px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fbfcff;
}

.finance-package-section h5 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 14px;
}

.finance-package-section p {
  margin: 8px 0 0;
  color: #7d8798;
  font-size: 12px;
}

.finance-package-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.finance-package-fields label {
  display: grid;
  gap: 5px;
  color: #536176;
  font-size: 12px;
  font-weight: 700;
}

.finance-package-fields input,
.finance-package-fields select {
  width: 100%;
  height: 36px;
  box-sizing: border-box;
}

.finance-package-fields input:disabled {
  background: #f3f4f6;
  color: #8a94a6;
}

.finance-package-wide {
  grid-column: span 2;
}

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

.finance-drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, .18);
}

.finance-drawer-mask.hidden,
.finance-drawer.hidden,
.finance-drawer-panel.hidden {
  display: none;
}

.finance-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 71;
  width: min(520px, 92vw);
  height: 100vh;
  box-sizing: border-box;
  padding: 16px;
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid #dfe4ef;
  box-shadow: -12px 0 28px rgba(15, 23, 42, .08);
}

.finance-detail-drawer {
  width: min(640px, 94vw);
}

.finance-message-drawer {
  width: min(620px, 94vw);
}

.finance-package-delete-drawer {
  width: min(460px, 92vw);
}

.finance-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf0f5;
}

.finance-drawer-head h4 {
  margin: 0 0 3px;
  color: #111827;
  font-size: 17px;
}

.finance-drawer-head p {
  margin: 0;
  color: #7d8798;
  font-size: 12px;
}

.finance-drawer-head button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #dbe1ee;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.finance-drawer-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 0;
}

.finance-drawer-summary div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.finance-drawer-summary span {
  display: block;
  color: #7d8798;
  font-size: 12px;
}

.finance-drawer-summary strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #111827;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-drawer-summary .internal-id-summary small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-drawer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0;
  padding: 3px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.finance-drawer-tabs button {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #536176;
  font-weight: 600;
  cursor: pointer;
}

.finance-drawer-tabs button.active {
  border-color: #dfe4ef;
  background: #fff;
  color: #1f32ff;
}

.finance-drawer-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.finance-drawer-panel label {
  display: grid;
  gap: 4px;
  color: #536176;
  font-size: 12px;
  font-weight: 600;
}

.finance-drawer-panel input,
.finance-drawer-panel select {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
}

.finance-drawer-note {
  grid-column: 1 / -1;
  padding: 7px 9px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
  color: #536176;
  font-size: 12px;
  line-height: 1.35;
}

.finance-drawer-panel > .primary-button {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 34px;
}

.finance-package-snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
  color: #7d8798;
  font-size: 13px;
}

.finance-package-snapshot div {
  display: grid;
  gap: 3px;
}

.finance-package-snapshot strong {
  color: #111827;
}

.finance-delete-warning {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff7f7;
  color: #7f1d1d;
}

.finance-delete-warning strong {
  display: block;
  margin-bottom: 8px;
  color: #991b1b;
  font-size: 15px;
}

.finance-delete-warning p {
  margin: 6px 0 0;
  color: #7f1d1d;
  font-size: 13px;
  line-height: 1.5;
}

.finance-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.finance-detail-block {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.finance-detail-block h5 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 14px;
}

.phone-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.phone-meta-row span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3139ff;
  font-size: 12px;
  line-height: 1;
}

.finance-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.finance-detail-grid div {
  padding: 10px;
  border-radius: 6px;
  background: #f8f9fc;
}

.finance-detail-grid dt {
  color: #7d8798;
  font-size: 12px;
}

.finance-detail-grid dd {
  margin: 4px 0 0;
  color: #111827;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.finance-detail-line {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .9fr) auto;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f5;
  align-items: center;
  font-size: 13px;
}

.finance-detail-line:last-child {
  border-bottom: 0;
}

.finance-detail-line strong,
.finance-detail-line span,
.finance-detail-line em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-detail-line em {
  color: #8a94a6;
  font-style: normal;
}

.finance-detail-empty {
  color: #9aa3b2;
  font-size: 13px;
}

.finance-raw-note {
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  background: #f8f9fc;
  color: #536176;
  font-size: 13px;
  line-height: 1.5;
}

.finance-raw-note strong {
  display: block;
  margin-bottom: 4px;
  color: #111827;
}

.finance-raw-note span {
  overflow-wrap: anywhere;
}

.finance-message-body {
  max-height: calc(100vh - 180px);
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1f2937;
  font: inherit;
  line-height: 1.6;
}

/* ===== Recharge Placeholder ===== */
.recharge-placeholder-panel {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: 24px;
  overflow: auto;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recharge-placeholder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.recharge-placeholder-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #111827;
}

.recharge-placeholder-head p {
  margin: 0;
  max-width: 760px;
  font-size: 13px;
  color: #7d8798;
  line-height: 1.7;
}

.recharge-status-badge {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.recharge-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.recharge-metric-card {
  padding: 14px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
}

.recharge-metric-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: #7d8798;
}

.recharge-metric-card strong {
  font-size: 18px;
  color: #111827;
}

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

.recharge-feature-card {
  min-height: 116px;
  padding: 16px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.recharge-feature-card > div:first-child {
  flex: 1 1 260px;
  min-width: 0;
}

.recharge-feature-card[data-recharge-action] {
  cursor: pointer;
}

.recharge-feature-action {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.recharge-feature-card[data-recharge-action]:hover,
.recharge-feature-action:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.recharge-feature-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #111827;
}

.recharge-feature-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #6b7280;
}

.recharge-feature-card > span {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 12px;
}

.recharge-feature-disabled {
  background: #f8f9fb;
}

.recharge-feature-disabled > span {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.recharge-feature-stats {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #edf0f5;
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
}

.recharge-feature-stats span {
  min-width: 0;
  white-space: nowrap;
}

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

.recharge-boundary-card,
.recharge-order-placeholder {
  padding: 16px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #fff;
}

.recharge-boundary-card h4,
.recharge-order-placeholder h4 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #111827;
}

.recharge-boundary-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recharge-boundary-card span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #f8f9fc;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.2;
}

.recharge-order-placeholder {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.recharge-order-placeholder p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.7;
}

.recharge-order-placeholder > span {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 12px;
}

.recharge-placeholder-note {
  padding: 14px 16px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.7;
}

.recharge-admin-panel {
  position: relative;
}

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

.recharge-metric-card small {
  display: block;
  margin-top: 6px;
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.4;
}

.recharge-card-title-row {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.recharge-card-title-row > span {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 12px;
}

.recharge-order-card {
  display: block;
}

.recharge-table-wrap {
  overflow-x: auto;
}

.recharge-order-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.recharge-order-table th,
.recharge-order-table td {
  padding: 10px 8px;
  border-top: 1px solid #eef1f6;
  text-align: left;
  vertical-align: top;
  color: #374151;
}

.recharge-order-table th {
  color: #7d8798;
  font-weight: 700;
  background: #fafbfe;
}

.recharge-order-table th:nth-child(1) { width: 20%; }
.recharge-order-table th:nth-child(2) { width: 18%; }
.recharge-order-table th:nth-child(3) { width: 10%; }
.recharge-order-table th:nth-child(4) { width: 12%; }
.recharge-order-table th:nth-child(5) { width: 11%; }
.recharge-order-table th:nth-child(6) { width: 9%; }
.recharge-order-table th:nth-child(7) { width: 8%; }
.recharge-order-table th:nth-child(8) { width: 6%; }
.recharge-order-table th:nth-child(9) { width: 6%; }

.recharge-order-table strong,
.recharge-order-table small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recharge-order-id {
  max-width: 100%;
  font-family: Consolas, "SFMono-Regular", "Roboto Mono", monospace;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.recharge-order-table small {
  margin-top: 4px;
  color: #8a94a6;
  font-size: 12px;
}

.empty-cell {
  padding: 28px 12px !important;
  text-align: center !important;
  color: #8a94a6 !important;
}

.ghost-button.compact {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.recharge-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f7ef;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.recharge-status-pill.status-pending {
  background: #fff7ed;
  color: #c2410c;
}

.recharge-status-pill.status-failed,
.recharge-status-pill.status-canceled {
  background: #fef2f2;
  color: #dc2626;
}

.recharge-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.28);
}

.recharge-drawer {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 81;
  width: min(760px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e6e8f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

.recharge-detail-drawer {
  width: min(680px, calc(100vw - 48px));
}

.recharge-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #eef1f6;
}

.recharge-drawer-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: #111827;
}

.recharge-drawer-head p {
  margin: 0;
  max-width: 560px;
  color: #7d8798;
  font-size: 13px;
  line-height: 1.5;
}

.drawer-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.drawer-close:hover {
  background: #f8fafc;
}

.recharge-drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px;
}

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

.recharge-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.recharge-form-grid label span {
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.recharge-form-grid label b {
  color: #dc2626;
}

.recharge-form-grid input,
.recharge-form-grid select,
.recharge-form-grid textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9dce6;
  border-radius: 8px;
  padding: 8px 10px;
  color: #111827;
  font: inherit;
  font-size: 13px;
}

.recharge-form-grid input,
.recharge-form-grid select {
  min-height: 36px;
}

.recharge-form-grid textarea {
  resize: vertical;
  min-height: 58px;
}

.recharge-form-grid input:disabled,
.recharge-form-grid select:disabled {
  background: #f8f9fc;
  color: #6b7280;
}

.recharge-form-wide {
  grid-column: 1 / -1;
}

.recharge-readonly-field {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #e6e8f0;
  border-radius: 8px;
  background: #f8f9fc;
  box-sizing: border-box;
}

.recharge-readonly-field span {
  display: block;
  margin-bottom: 5px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.recharge-readonly-field strong {
  color: #111827;
  font-size: 13px;
}

.recharge-form-grid label small {
  margin-top: -2px;
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.4;
}

.recharge-user-results {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #eef1f6;
  border-radius: 8px;
  background: #fff;
}

.recharge-user-results:empty {
  display: none;
}

.recharge-user-result {
  width: 100%;
  display: block;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.recharge-user-result:last-child {
  border-bottom: 0;
}

.recharge-user-result:hover,
.recharge-user-result.active {
  background: #eff6ff;
}

.recharge-user-result strong,
.recharge-user-result span,
.recharge-user-result small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recharge-user-result strong {
  color: #111827;
  font-size: 13px;
}

.recharge-user-result span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.recharge-user-result small {
  margin-top: 3px;
  color: #8a94a6;
  font-size: 12px;
}

.recharge-user-result.muted {
  cursor: default;
  color: #8a94a6;
}

.recharge-package-snapshot {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  color: #475569;
  font-size: 12px;
}

.recharge-package-snapshot strong {
  display: block;
  margin-top: 4px;
  color: #1d4ed8;
  font-size: 15px;
}

.recharge-package-snapshot.muted {
  display: block;
  color: #8a94a6;
}

.recharge-form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}

.recharge-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid #eef1f6;
  background: #fff;
}

.recharge-confirm-button {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.16);
}

.recharge-confirm-button:hover {
  background: #1e40af;
  border-color: #1e40af;
}

.recharge-confirm-button:disabled {
  background: #93c5fd;
  border-color: #93c5fd;
  cursor: not-allowed;
  opacity: 0.78;
}

.recharge-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.recharge-detail-grid div,
.recharge-detail-note {
  padding: 10px 12px;
  border: 1px solid #eef1f6;
  border-radius: 8px;
  background: #fbfcff;
}

.recharge-detail-grid span {
  display: block;
  margin-bottom: 5px;
  color: #8a94a6;
  font-size: 12px;
}

.recharge-detail-grid strong {
  display: block;
  min-width: 0;
  color: #111827;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.recharge-detail-note {
  margin-top: 12px;
}

.recharge-detail-note strong {
  display: block;
  margin: 0 0 5px;
  color: #374151;
  font-size: 13px;
}

.recharge-detail-note p {
  margin: 0 0 10px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ===== Leads Management ===== */
.leads-panel { padding: 16px 24px 24px; }
.leads-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.leads-head-compact { padding-top: 2px; }
.leads-head h3 { font-size: 18px; margin: 0 0 4px 0; }
.leads-stage-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0; }
.stage-pill { padding: 4px 14px; border-radius: 14px; border: 1px solid #d9dce6; background: #fff; font-size: 13px; color: #555; cursor: pointer; }
.stage-pill.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.leads-list { display: flex; flex-direction: column; gap: 10px; }
.lead-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px; cursor: pointer; transition: box-shadow .15s; }
.lead-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.lead-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lead-user { font-weight: 600; font-size: 14px; color: #1a1a2e; }
.lead-stage { font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.stage-new { background: #fef3c7; color: #92400e; }
.stage-contacted { background: #dbeafe; color: #1e40af; }
.stage-qualified { background: #e0e7ff; color: #3730a3; }
.stage-proposal { background: #ede9fe; color: #5b21b6; }
.stage-negotiation { background: #fce7f3; color: #9d174d; }
.stage-won { background: #d1fae5; color: #065f46; }
.stage-lost { background: #f3f4f6; color: #6b7280; }
.lead-need { font-size: 13px; color: #555; margin-bottom: 4px; }
.lead-meta { font-size: 12px; color: #999; }
.leads-detail.hidden { display: none; }
.back-link { background: none; border: none; color: #3b82f6; font-size: 14px; cursor: pointer; margin-bottom: 12px; padding: 0; }
.lead-detail-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; }
.lead-detail-row { display: flex; justify-content: flex-start; align-items: flex-start; gap: 18px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.lead-detail-row:last-child { border-bottom: none; }
.lead-detail-row strong { flex: 0 0 112px; color: #333; min-width: 0; }
.lead-detail-row span,
.lead-detail-row > div { color: #666; text-align: left; flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.lead-stage-field p { margin: 6px 0 0; color: #8a94a6; font-size: 12px; line-height: 1.5; }
.lead-stage-select { border: 1px solid #d9dce6; border-radius: 6px; padding: 2px 8px; font-size: 13px; }

/* Sale Settings */
.save-inline-button { width: auto; padding: 6px 20px; font-size: 13px; }
.sale-metered-config { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sale-metered-config.hidden { display: none; }
.sale-metered-config label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sale-metered-config input[type="number"] { width: 80px; padding: 4px 8px; border: 1px solid #d9dce6; border-radius: 4px; font-size: 13px; }
.model-tag { display: inline-block; padding: 2px 10px; background: #eef2ff; border-radius: 4px; font-weight: 600; font-size: 13px; color: #3730a3; }

.model-pricing-list { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.pricing-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f8f9fc; border-radius: 6px; font-size: 13px; }
.pricing-row span { font-weight: 600; color: #3730a3; }
.pricing-row input[type="number"] { width: 80px; padding: 4px 8px; border: 1px solid #d9dce6; border-radius: 4px; font-size: 13px; }


/* Models Management */
.models-table-card { display: flex; flex-direction: column; gap: 10px; min-height: 80px; }
.modal-card:not(.model-config-dialog) .model-edit-form { display: flex; flex-direction: column; gap: 12px; }
.modal-card:not(.model-config-dialog) .model-edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #444; }
.modal-card:not(.model-config-dialog) .model-edit-form label input,
.modal-card:not(.model-config-dialog) .model-edit-form label select { padding: 6px 10px; border: 1px solid #d9dce6; border-radius: 6px; font-size: 13px; }

.model-detail-panel { padding: 16px; min-height: 200px; }

/* ===== Models Management ===== */
.models-view { padding: 0 24px 24px; }
.models-view #modelsList {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.models-view .model-card {
  min-height: 120px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 16px;
  padding: 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  min-height: 100px;
}
.models-view .model-card:hover {
  border-color: #c5cbff;
  box-shadow: 0 8px 18px rgba(30, 64, 175, 0.05);
}
.model-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.model-card-body h3 {
  font-size: 15px;
  margin: 0 0 4px 0;
  color: #1a1a2e;
}
.model-card-provider {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}
.model-card-endpoint {
  font-size: 12px;
  color: #999;
  margin: 0 0 10px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}
.model-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.model-tag-chip {
  color: #647086;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  background: #f9fafb;
}
.model-tag-cost {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
  font-weight: 600;
}
.model-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.model-card-actions .ghost-button {
  padding: 4px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.models-view #modelsList {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.models-view .model-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  min-height: 100px;
}
.models-view .model-card:hover {
  border-color: #c5cbff;
  box-shadow: 0 8px 18px rgba(30, 64, 175, 0.05);
}
.model-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.model-card-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.model-card-name-row h3 {
  font-size: 15px;
  margin: 0;
  color: #1a1a2e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.model-status {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
}
.model-status-on { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.model-status-off { background: #f8fafc; color: #667085; border-color: #e5e7eb; }
.model-card-provider {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}
.model-card-endpoint {
  font-size: 11px;
  color: #aaa;
  margin: 0 0 8px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-card-summary {
  margin: 0 0 5px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}
.model-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.model-tag-chip {
  color: #647086;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  background: #f9fafb;
}
.model-tag-cost {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
  font-weight: 600;
}
.model-tag-vision {
  color: #155eef;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.models-view .model-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.models-view .model-card-actions .ghost-button {
  min-width: 76px;
  height: 32px;
  padding: 0 16px;
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.models-view .model-card-actions .ghost-button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}
.models-view .model-card-actions .danger-button {
  border-color: #fecdd3;
  color: var(--danger);
  background: var(--danger-soft);
}
.models-view .model-card-actions .danger-button:hover {
  border-color: #fda4af;
  background: #ffe4e6;
}
.folder-row { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 10px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.folder-row:hover { background: #f3f4f6; }
.folder-row.active { background: #eef2ff; color: #3730a3; font-weight: 600; }
.folder-name { flex: 1; }
.folder-name span { font-size: 11px; color: #888; margin-left: 8px; }
.folder-row small { color: var(--muted); font-size: 12px; font-weight: 400; }
.folder-delete-btn { border: none; background: none; color: #ef4444; font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1; opacity: 0; }
.folder-row:hover .folder-delete-btn { opacity: 1; }

.folder-row .folder-name { cursor: pointer; }

.search-config-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin: 16px 0 16px 0;
}
.search-config-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.search-config-header h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #111827;
}
.search-config-header .model-card-provider {
  margin: 0;
}
.search-config-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.search-config-actions .switch-line {
  white-space: nowrap;
}
.search-config-fields { display: grid; grid-template-columns: 180px minmax(260px, 1fr) minmax(260px, 360px); gap: 12px; margin-top: 2px; }
.search-config-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #888; }
.search-config-fields label input,
.search-config-fields label select { padding: 5px 8px; border: 1px solid #d9dce6; border-radius: 5px; font-size: 12px; min-width: 180px; }
.search-secret-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  color: #667085;
  font-size: 12px;
}
.search-secret-panel {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
}
.search-secret-panel .model-secret-status-row {
  min-height: 28px;
}
.search-secret-panel .model-secret-input-row {
  margin-top: 8px;
}

.models-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 14px;
}
.models-list-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #111827;
}
.models-list-head p {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
}
.models-list-head .primary-button {
  flex: 0 0 auto;
}

.model-config-dialog .model-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.model-config-dialog .model-section-title-row h3 {
  margin: 0;
}
.model-config-dialog .model-cache-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.model-config-dialog .model-form-section label.model-price-row {
  grid-template-columns: 128px 180px auto;
  justify-content: start;
  align-items: center;
  gap: 10px;
}
.model-config-dialog .model-price-row span {
  white-space: nowrap;
}
.model-config-dialog .model-form-section .model-price-row input {
  width: 180px;
  max-width: 180px;
}
.model-config-dialog .model-price-row em {
  color: #6b7280;
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}
.model-config-dialog .model-cache-hit-row.hidden {
  display: none;
}
.model-config-dialog .model-cache-hit-row input:disabled {
  color: #9ca3af;
  background: #f3f4f6;
}
.model-config-dialog .model-form-section label.model-pricing-note-row {
  grid-template-columns: 128px minmax(0, 1fr);
}

.model-config-dialog .modal-title {
  height: 54px;
  padding: 0 20px;
}
.model-config-dialog .modal-title h2 {
  font-size: 18px;
}
.model-config-dialog .modal-close {
  width: 30px;
  height: 30px;
  font-size: 24px;
}
.model-config-dialog .modal-actions {
  padding: 12px 20px 14px;
}
.model-config-dialog .model-edit-form {
  gap: 12px;
  padding: 14px 18px;
}
.model-config-dialog .model-form-side {
  gap: 10px;
}
.model-config-dialog .model-form-section {
  gap: 10px;
  padding: 12px;
}
.model-config-dialog .model-form-section label {
  grid-template-columns: minmax(136px, 170px) minmax(0, 1fr);
  gap: 8px;
}
.model-config-dialog .model-form-section input,
.model-config-dialog .model-form-section select {
  min-height: 32px;
  padding: 6px 9px;
}
.model-config-dialog .model-form-advanced summary {
  gap: 2px;
}
.model-config-dialog .model-form-advanced summary small,
.model-config-dialog .model-form-note {
  line-height: 1.4;
}

@media (max-width: 980px) {
  .search-config-header,
  .models-list-head {
    align-items: stretch;
    flex-direction: column;
  }
  .search-config-fields {
    grid-template-columns: 1fr;
  }
}

.tenant-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 0; margin-bottom: 22px; }
.tenant-toolbar .search-box { flex: 1 1 420px; min-width: 320px; display: flex; align-items: center; gap: 8px; }
.tenant-toolbar .search-box select { width: 180px; height: 38px; border: 1px solid #d9ddea; border-radius: 6px; padding: 0 10px; color: #111827; background: #fff; }
.tenant-toolbar .search-box input { flex: 1 1 260px; min-width: 180px; width: auto; }
.tenant-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.tenant-actions button {
  flex: 0 0 auto;
  height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}
.frontend-miniapp-instance { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(130px, .75fr) minmax(150px, .8fr) minmax(150px, .8fr) auto; align-items: center; gap: 14px; margin: -4px 0 18px; padding: 16px 18px; border: 1px solid #dfe6f5; border-radius: 8px; background: #ffffff; box-shadow: none; }
.frontend-miniapp-main,
.frontend-miniapp-meta { min-width: 0; display: grid; gap: 4px; }
.frontend-miniapp-main span,
.frontend-miniapp-meta span { color: #667085; font-size: 12px; line-height: 1.2; }
.frontend-miniapp-main strong { overflow: hidden; color: #111827; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.frontend-miniapp-meta strong { overflow: hidden; color: #344054; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.frontend-miniapp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.frontend-miniapp-config-button { height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; white-space: nowrap; }
.tenant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0; }
.tenant-card { position: relative; min-height: 156px; display: grid; grid-template-columns: 62px 1fr; gap: 16px; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.tenant-card:hover { border-color: #c5cbff; box-shadow: 0 8px 18px rgba(30, 64, 175, .05); }
.tenant-card.selected { border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30, 64, 175, .08); }
.tenant-select-box { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tenant-select-box input { width: 16px; height: 16px; accent-color: #3139ff; cursor: pointer; }
.tenant-card-avatar { width: 58px; height: 58px; border-radius: 50%; background: #eef2ff; color: #3730a3; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; flex-shrink: 0; }
.tenant-card-body { overflow: hidden; }
.tenant-card-body h3 { font-size: 16px; margin: 0 0 6px 0; color: #1a1a2e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.tenant-number { font-size: 12px; color: #888; font-weight: 400; margin-left: 4px; }
.tenant-card-desc { font-size: 13px; color: #999; margin: 0 0 12px 0; }
.tenant-card-tags { display: flex; gap: 8px; }
.tenant-card-tags .tag { color: #647086; border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; font-size: 12px; }
.tenant-card-tags .tag-blue { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; font-weight: 600; }
.content-miniapp-ownership { display: grid; gap: 5px; min-width: 0; margin: 8px 0 12px; }
.content-miniapp-ownership span { overflow: hidden; color: #344054; font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.content-miniapp-ownership em { width: fit-content; max-width: 100%; overflow: hidden; padding: 3px 7px; color: #155eef; background: #eff4ff; border: 1px solid #c7d7fe; border-radius: 999px; font-size: 12px; font-style: normal; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.content-back-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 0 24px; }
.content-back-row .content-miniapp-ownership { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; }
.content-save-button { flex: 0 0 auto; margin-left: 4px; }
.tenant-title { font-size: 16px; font-weight: 600; color: #1a1a2e; }
.tenant-create-dialog { width: min(560px, calc(100vw - 48px)); }
.tenant-create-form { display: grid; gap: 14px; padding: 20px 24px 8px; }
.tenant-create-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: #344054; }
.tenant-create-form input,
.tenant-create-form select { width: 100%; height: 38px; border: 1px solid #d9ddea; border-radius: 6px; padding: 0 11px; color: #111827; background: #fff; box-sizing: border-box; }
.tenant-create-hosting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 0 12px; border: 1px solid #e5e7eb; border-radius: 6px; background: #f8fafc; }
.tenant-create-hosting span { color: #667085; font-size: 13px; }
.tenant-create-hosting strong { color: #155eef; font-size: 13px; }
.tenant-create-form .form-error { min-height: 18px; margin: -4px 0 0; color: #c52b2b; font-size: 13px; }
.frontend-miniapp-config-dialog { width: min(780px, calc(100vw - 48px)); max-height: min(86vh, 780px); display: flex; flex-direction: column; }
.frontend-miniapp-config-dialog .modal-title,
.frontend-miniapp-config-dialog .modal-actions { flex: 0 0 auto; }
.frontend-miniapp-config-body { flex: 1 1 auto; overflow: auto; display: grid; gap: 12px; padding: 18px 24px 8px; }
.frontend-miniapp-config-body section { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; border: 1px solid #edf0f6; border-radius: 8px; background: #fbfcff; }
.frontend-miniapp-config-body section h3 { grid-column: 1 / -1; margin: 0; color: #111827; font-size: 14px; line-height: 1.3; }
.frontend-miniapp-config-body label { min-width: 0; display: grid; gap: 6px; color: #344054; font-size: 13px; font-weight: 600; }
.frontend-miniapp-config-body input,
.frontend-miniapp-config-body select,
.frontend-miniapp-config-body textarea { width: 100%; border: 1px solid #d9ddea; border-radius: 6px; color: #111827; background: #fff; box-sizing: border-box; font-size: 13px; }
.frontend-miniapp-config-body input,
.frontend-miniapp-config-body select { height: 38px; padding: 0 11px; }
.frontend-miniapp-config-body textarea { min-height: 78px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.frontend-miniapp-readonly { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 38px; padding: 0 11px; border: 1px solid #e5e7eb; border-radius: 6px; background: #f8fafc; }
.frontend-miniapp-readonly span { color: #667085; font-size: 13px; }
.frontend-miniapp-readonly strong { min-width: 0; color: #111827; font-size: 13px; font-weight: 600; word-break: break-word; }
.frontend-miniapp-config-body .form-error { grid-column: 1 / -1; min-height: 18px; margin: -2px 0 0; color: #c52b2b; font-size: 13px; }
.frontend-miniapp-config-body .frontend-miniapp-note-section { grid-template-columns: 1fr; }
.frontend-miniapp-note-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 12px; align-items: stretch; }
.frontend-miniapp-meta-lines { display: grid; gap: 8px; align-content: start; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 6px; background: #f8fafc; }
.frontend-miniapp-meta-lines p { display: grid; gap: 4px; margin: 0; }
.frontend-miniapp-meta-lines span { color: #667085; font-size: 12px; }
.frontend-miniapp-meta-lines strong { color: #111827; font-size: 13px; font-weight: 600; word-break: break-word; }
.frontend-miniapp-create-dialog { width: min(620px, calc(100vw - 48px)); }
.frontend-miniapp-create-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 24px 8px; }
.frontend-miniapp-create-body label { display: grid; gap: 7px; min-width: 0; color: #344054; font-size: 13px; font-weight: 600; }
.frontend-miniapp-create-body input,
.frontend-miniapp-create-body select,
.frontend-miniapp-create-body textarea { width: 100%; border: 1px solid #d9ddea; border-radius: 6px; color: #111827; background: #fff; box-sizing: border-box; font-size: 13px; }
.frontend-miniapp-create-body input,
.frontend-miniapp-create-body select { height: 38px; padding: 0 11px; }
.frontend-miniapp-create-body textarea { min-height: 78px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.frontend-miniapp-create-remark,
.frontend-miniapp-create-body .form-error { grid-column: 1 / -1; }
.frontend-miniapp-create-body .form-error { min-height: 18px; margin: -2px 0 0; color: #c52b2b; font-size: 13px; }

@media (max-width: 980px) {
  .frontend-miniapp-instance { grid-template-columns: 1fr 1fr; }
  .frontend-miniapp-actions { justify-content: flex-start; flex-wrap: wrap; }
  .frontend-miniapp-config-body section { grid-template-columns: 1fr; }
  .frontend-miniapp-note-grid,
  .frontend-miniapp-create-body { grid-template-columns: 1fr; }
}

.content-view {
  padding: 0 24px 24px;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.content-view .section-head { flex: 0 0 auto; min-height: 60px; display: flex; align-items: center; gap: 14px; padding: 20px 0 0; margin-bottom: 20px; }
#contentSections {
  padding-bottom: 64px;
}
.content-section-block {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid #e7e9f2;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfcff);
  box-shadow: 0 12px 34px rgba(20, 28, 55, .04);
}
.content-section-title {
  margin-bottom: 14px;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
  color: #111827;
}
.content-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 980px) {
  .content-cards-grid {
    grid-template-columns: 1fr;
  }
}
.content-card {
  padding: 18px;
  border: 1px solid #e4e7f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}
.content-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f0f2f7;
}
.content-card-head strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: #111827;
}
.content-card-head p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #7b8497;
}
.content-card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.content-card-fields label,
.content-image-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  color: #667085;
}
.content-image-hint {
  margin: -2px 0 2px;
  font-size: 12px;
  line-height: 1.45;
  color: #8a94a6;
}
.content-card-fields input,
.content-card-fields textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9ddea;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  color: #111827;
  outline: none;
  resize: vertical;
}
.content-card-fields input:focus,
.content-card-fields textarea:focus {
  border-color: #3139ff;
  box-shadow: 0 0 0 3px rgba(49,57,255,.08);
}
.content-card-fields .wide-field,
.content-image-field {
  grid-column: 1 / -1;
}
.content-card-img {
  width: 220px;
  max-width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e7ef;
  background: #f6f7fb;
}
.content-card-img.ai-agent-banner {
  aspect-ratio: 750 / 360;
}
.content-card-img.profile-banner {
  aspect-ratio: 686 / 240;
}
.content-card-img.qr {
  width: 220px;
  height: 128px;
  aspect-ratio: auto;
}
.content-card-img.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #98a2b3;
  font-size: 12px;
}
.content-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.legal-settings-block {
  margin-bottom: 48px;
}

.legal-template-block {
  margin-top: 18px;
}

.legal-settings-desc {
  margin: -4px 0 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #667085;
}

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

.legal-template-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid #e4e7f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.legal-template-card strong {
  display: block;
  font-size: 15px;
  color: #111827;
}

.legal-template-card p {
  margin: 7px 0 5px;
  font-size: 13px;
  color: #667085;
}

.legal-template-card span {
  font-size: 12px;
  color: #98a2b3;
}

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

.legal-card {
  padding: 16px;
  border: 1px solid #e4e7f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.legal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f0f2f7;
}

.legal-card-head strong {
  font-size: 14px;
  color: #111827;
}

.legal-card-head span,
.legal-template-tip {
  font-size: 12px;
  line-height: 1.45;
  color: #8a94a6;
}

.legal-card label,
.legal-custom-fields {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.legal-card label {
  margin-bottom: 12px;
  font-size: 12px;
  color: #667085;
}

.legal-card input,
.legal-card select,
.legal-card textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9ddea;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  color: #111827;
  background: #fff;
  outline: none;
}

.legal-card textarea {
  resize: vertical;
  line-height: 1.6;
}

.legal-card input:focus,
.legal-card select:focus,
.legal-card textarea:focus {
  border-color: #3139ff;
  box-shadow: 0 0 0 3px rgba(49,57,255,.08);
}

.legal-template-tip {
  margin: 0;
}

.recycle-view {
  padding: 26px;
  overflow-y: auto;
}

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

.recycle-card {
  padding: 20px;
  border: 1px solid #e4e7f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}

.recycle-boundary-card {
  border-color: #dbe5ff;
  background: #f8faff;
}

.recycle-card-head,
.recycle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.recycle-card-head {
  margin-bottom: 16px;
}

.recycle-card-head h3 {
  margin: 0;
  font-size: 18px;
  color: #111827;
}

.recycle-card-head span {
  font-size: 13px;
  color: #667085;
}

.recycle-list,
.service-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recycle-item,
.service-log-row {
  padding: 14px;
  border: 1px solid #eef1f7;
  border-radius: 8px;
  background: #fafbff;
}

.recycle-main {
  min-width: 0;
}

.recycle-item strong {
  font-size: 15px;
  color: #111827;
}

.recycle-item p {
  margin: 5px 0 0;
  font-size: 13px;
  color: #667085;
}

.recycle-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  font-size: 12px;
  color: #8a94a6;
}

.recycle-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.recycle-confirm-card .confirm-body p {
  margin: 0;
  color: #374151;
  line-height: 1.6;
}

.danger-solid-button {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.danger-solid-button:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.service-log-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}

.service-log-toolbar input {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #d9deea;
  border-radius: 6px;
  color: #111827;
  background: #ffffff;
}

.service-log-toolbar input:focus {
  border-color: #3139ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(49, 57, 255, .08);
}

.service-log-toolbar span {
  justify-self: end;
  font-size: 13px;
  color: #8a94a6;
}

.service-log-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.service-log-row span,
.service-log-row em {
  color: #8a94a6;
  font-style: normal;
}

.service-log-row strong {
  color: #111827;
  font-weight: 600;
}
.public-module-options {
  display: grid;
  gap: 10px;
  padding: 20px 24px;
}

.public-module-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #dbe2ef;
  border-radius: 6px;
  cursor: pointer;
}

.public-module-options input {
  width: 18px;
  height: 18px;
  margin: 0;
}
.content-safety-view,
.records-view {
  min-width: 0;
}

.records-center-shell {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.records-center-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid #dbe2ef;
  border-radius: 10px;
  background: #f8fafc;
}

.records-center-tab {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  font-weight: 600;
  cursor: pointer;
}

.records-center-tab.active {
  background: #fff;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.records-shared-toolbar {
  display: grid;
  grid-template-columns:
    minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(160px, 1fr)
    minmax(160px, 1fr) minmax(140px, 0.9fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.records-shared-toolbar input,
.records-shared-toolbar select {
  min-width: 0;
  width: 100%;
}

.records-tab-panel {
  min-width: 0;
}

.records-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  font-size: 13px;
}

.records-pagination > span {
  margin-right: auto;
}

.records-pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.records-pagination select {
  width: auto;
  min-width: 72px;
}

.records-tab-toolbar {
  display: flex;
  order: 0;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.records-tab-toolbar select {
  min-width: 180px;
}

.record-detail-trigger {
  cursor: pointer;
}

tr.record-detail-trigger:hover td,
tr.record-detail-trigger:focus td {
  background: #f8fbff;
}

.record-detail-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.32);
}

.record-detail-drawer-backdrop.hidden {
  display: none;
}

.record-detail-drawer {
  width: min(620px, calc(100vw - 32px));
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -12px 0 36px rgba(15, 23, 42, 0.18);
}

.record-detail-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid #e2e8f0;
}

.record-detail-drawer-head h3,
.record-detail-drawer-head p {
  margin: 0;
}

.record-detail-drawer-head p {
  margin-top: 5px;
  color: #64748b;
  font-size: 13px;
}

.record-detail-drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
}

.record-context-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.record-context-scope span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
}

.record-context-section {
  padding: 15px 0;
  border-bottom: 1px solid #eef2f7;
}

.record-context-section h4 {
  margin: 0 0 10px;
  color: #0f172a;
}

.record-context-text,
.record-context-fact,
.record-context-empty {
  overflow-wrap: anywhere;
  line-height: 1.65;
}

.record-context-text {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.record-context-fact {
  display: grid;
  gap: 5px;
  padding: 11px 0;
}

.record-context-fact + .record-context-fact {
  border-top: 1px dashed #e2e8f0;
}

.record-context-fact span,
.record-context-fact small,
.record-context-empty {
  color: #64748b;
}

@media (max-width: 1100px) {
  .records-shared-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.content-safety-card {
  margin: 0;
}

.content-safety-toolbar {
  order: 0;
  flex-wrap: wrap;
  grid-template-columns:
    minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1fr)
    minmax(140px, 1fr) minmax(120px, 1fr) auto;
}

.content-safety-table {
  min-width: 1180px;
}

.content-safety-card > .model-card-provider,
.content-safety-card > .analytics-table-scroll {
  order: 0;
}

.content-safety-card > .model-card-provider {
  padding: 10px 12px 0;
}

.manual-review-table {
  min-width: 1360px;
}

.manual-review-table td:nth-child(5),
.manual-review-table td:nth-child(9) {
  min-width: 170px;
  max-width: 190px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.manual-review-table th:nth-child(6),
.manual-review-table td:nth-child(6),
.manual-review-table th:nth-child(7),
.manual-review-table td:nth-child(7) {
  min-width: 96px;
}

.manual-review-table td:nth-child(8) {
  min-width: 220px;
  max-width: 360px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.manual-review-modal-card {
  width: min(620px, calc(100vw - 40px));
}

.manual-review-form {
  display: grid;
  gap: 14px;
  padding: 0 24px 20px;
}

.manual-review-form label {
  display: grid;
  gap: 7px;
  color: #475569;
  font-size: 13px;
}

.manual-review-form select,
.manual-review-form textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
