:root {
  color: #2e210f;
  background: #fff7df;
  font-family:
    "Inter", "MiSans", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 207, 62, 0.42), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(255, 142, 45, 0.22), transparent 28%),
    linear-gradient(135deg, #fff3c2 0%, #fff8e8 48%, #fff2d2 100%);
}

.topbar {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  max-width: 1460px;
  margin: 0 auto 18px;
  padding: 15px 18px;
  border: 1px solid rgba(255, 184, 28, 0.45);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 20px 55px rgba(155, 94, 0, 0.13);
  backdrop-filter: blur(16px);
}

.app-shell:has(.service-home) {
  overflow: auto;
}

.topbar:has(+ .service-home) {
  display: none;
}

.topbar:has(+ .player-workspace) {
  display: none;
}

.topbar:has(+ .workspace) {
  display: none;
}

.topbar:has(+ .settings-page) {
  display: none;
}

.service-home {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 8px 0 24px;
}

.service-hero,
.home-card {
  border: 1px solid rgba(255, 190, 52, 0.5);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 249, 233, 0.9)),
    radial-gradient(circle at 85% 15%, rgba(255, 199, 50, 0.28), transparent 32%);
  box-shadow: 0 24px 70px rgba(146, 88, 0, 0.12);
}

.service-hero {
  padding: clamp(24px, 4vw, 46px);
}

.home-brand {
  display: flex;
  gap: 18px;
  align-items: center;
}

.home-brand img {
  width: 132px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(217, 118, 0, 0.18));
}

.home-brand h1 {
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: -0.055em;
}

.home-intro {
  max-width: 760px;
  margin-top: 22px;
  color: #6e5226;
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.8;
}

.home-actions,
.home-section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.home-actions {
  justify-content: flex-start;
  margin-top: 28px;
}

.home-actions .primary-button,
.mobile-consult-button {
  min-width: 180px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  margin-top: 18px;
}

.home-card {
  padding: 22px;
}

.home-card p {
  margin-top: 10px;
  color: #76582b;
  line-height: 1.65;
}

.service-time-card h2 {
  font-size: clamp(26px, 3vw, 38px);
}

.service-scope,
.home-faq-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.service-scope span,
.home-faq-list button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #ffd477;
  border-radius: 999px;
  color: #704600;
  background: #fff7df;
  font-weight: 850;
}

.faq-card {
  margin-top: 18px;
}

.home-faq-list {
  margin-top: 18px;
}

.home-faq-list button:hover {
  background: #ffe7a6;
}

.mobile-consult-button {
  display: none;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand img {
  width: 116px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(217, 118, 0, 0.2));
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 21px;
  letter-spacing: -0.025em;
}

.eyebrow {
  margin-bottom: 4px;
  color: #b87900;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.service-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid #ffe0a1;
  border-radius: 999px;
  color: #705322;
  background: #fff6df;
  font-size: 14px;
  white-space: nowrap;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #25c764;
  box-shadow: 0 0 0 5px rgba(37, 199, 100, 0.14);
}

.ghost-button,
.primary-button,
.secondary-button {
  min-height: 42px;
  border: 0;
  border-radius: 15px;
  font-weight: 850;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.ghost-button {
  padding: 0 18px;
  color: #5a3900;
  background: #fff3c5;
  box-shadow: inset 0 0 0 1px #ffd576;
}

.primary-button {
  padding: 0 20px;
  color: #563100;
  background: linear-gradient(180deg, #ffd84b 0%, #ffad16 100%);
  box-shadow: 0 14px 24px rgba(245, 143, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.secondary-button {
  padding: 0 16px;
  color: #844e00;
  background: #fff0be;
  box-shadow: inset 0 0 0 1px #ffd36f;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.workspace {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 300px minmax(520px, 1fr) 390px;
  gap: 18px;
  width: 100%;
  min-height: 0;
  max-width: 1660px;
  margin: 0 auto;
  overflow: hidden;
}

.player-workspace {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1280px;
}

.player-workspace .chat-panel {
  width: 100%;
  position: relative;
}

.panel {
  min-height: 0;
  border: 1px solid rgba(255, 190, 52, 0.44);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 20px 60px rgba(146, 88, 0, 0.12);
  overflow: hidden;
}

.messages,
.conversation-list,
.info-panel,
.reply-list,
.knowledge-table,
.settings-page,
.setting-list {
  scrollbar-width: thin;
  scrollbar-color: #ffc23d #fff7e4;
}

.messages::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar,
.info-panel::-webkit-scrollbar,
.reply-list::-webkit-scrollbar,
.knowledge-table::-webkit-scrollbar,
.settings-page::-webkit-scrollbar,
.setting-list::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.messages::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track,
.info-panel::-webkit-scrollbar-track,
.reply-list::-webkit-scrollbar-track,
.knowledge-table::-webkit-scrollbar-track,
.settings-page::-webkit-scrollbar-track,
.setting-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdf8 0%, #fff2d2 100%);
}

.messages::-webkit-scrollbar-thumb,
.conversation-list::-webkit-scrollbar-thumb,
.info-panel::-webkit-scrollbar-thumb,
.reply-list::-webkit-scrollbar-thumb,
.knowledge-table::-webkit-scrollbar-thumb,
.settings-page::-webkit-scrollbar-thumb,
.setting-list::-webkit-scrollbar-thumb {
  border: 2px solid #fff7e4;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd86a 0%, #ffb321 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.messages::-webkit-scrollbar-thumb:hover,
.conversation-list::-webkit-scrollbar-thumb:hover,
.info-panel::-webkit-scrollbar-thumb:hover,
.reply-list::-webkit-scrollbar-thumb:hover,
.knowledge-table::-webkit-scrollbar-thumb:hover,
.settings-page::-webkit-scrollbar-thumb:hover,
.setting-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffc840 0%, #f79a00 100%);
}

.sidebar {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.panel-title,
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #ffebbc;
}

.player-subheader {
  padding: 14px 22px;
  background: #fffaf0;
}

.player-subheader h2 {
  font-size: 20px;
}

.badge {
  min-width: 34px;
  padding: 7px 10px;
  border-radius: 999px;
  text-align: center;
  color: #5b3600;
  background: #ffdb65;
  font-weight: 900;
}

.queue-badges,
.card-flags {
  display: flex;
  gap: 8px;
  align-items: center;
}

.queue-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid #ffebbc;
  background: #fffaf0;
}

.queue-summary span {
  padding: 6px 9px;
  border-radius: 999px;
  color: #704600;
  background: #fff0be;
  font-size: 12px;
  font-weight: 850;
}

.unread-total {
  padding: 7px 10px;
  border-radius: 999px;
  color: #ffffff;
  background: #ff5a1f;
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 10px 18px rgba(255, 90, 31, 0.22);
}

.conversation-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.conversation-card {
  display: block;
  width: 100%;
  padding: 15px;
  border: 1px solid transparent;
  border-radius: 20px;
  text-align: left;
  color: inherit;
  background: #fff8e6;
}

.conversation-card.unread {
  border-color: #ff8a1c;
  background: linear-gradient(180deg, #fff0bf 0%, #ffffff 100%);
  box-shadow: 0 12px 30px rgba(255, 134, 28, 0.2);
}

.conversation-card.active {
  border-color: #ffc038;
  background: linear-gradient(180deg, #fff4c8 0%, #ffffff 100%);
  box-shadow: 0 12px 28px rgba(248, 172, 22, 0.18);
}

.conversation-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.conversation-head strong,
.source-profile strong {
  display: block;
}

.conversation-head small,
.source-profile small {
  display: block;
  margin-top: 2px;
  color: #a48142;
  font-size: 12px;
  font-weight: 800;
}

.source-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  color: #5d3400;
  background: #ffe193;
  font-size: 12px;
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.source-avatar.web {
  background: linear-gradient(180deg, #ffe68a, #ffb629);
}

.source-avatar.h5 {
  color: #155333;
  background: linear-gradient(180deg, #d8ffe8, #7fe0a5);
}

.source-avatar.wechat {
  color: #0b5c32;
  background: linear-gradient(180deg, #c7ffd9, #45cf76);
}

.source-avatar.ai {
  color: #263a73;
  background: linear-gradient(180deg, #dfe7ff, #93a8ff);
}

.unread-dot {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: #ff4f18;
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 0 0 5px rgba(255, 79, 24, 0.12);
}

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

.row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.subtle {
  color: #9a7a43;
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status.bot {
  color: #6f4d00;
  background: #fff0b0;
}

.status.waiting {
  color: #9a3f00;
  background: #ffe1c6;
}

.status.human {
  color: #046337;
  background: #dff9e9;
}

.status.closed {
  color: #5d6472;
  background: #eef1f5;
}

.chat-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.player-chat-brand {
  display: flex;
  flex: 0 0 auto;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #ffebbc;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 249, 235, 0.92)),
    radial-gradient(circle at 90% 12%, rgba(255, 202, 55, 0.28), transparent 34%);
}

.player-workspace .player-subheader,
.player-workspace .service-ribbon,
.player-workspace .transfer-fixed {
  display: none;
}

.compact-brand {
  min-width: 0;
}

.compact-brand img {
  width: 90px;
  height: 42px;
}

.compact-brand h2 {
  font-size: clamp(24px, 2.4vw, 34px);
  letter-spacing: -0.05em;
}

.player-chat-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.compact-meta {
  padding: 8px 12px;
  background: rgba(255, 247, 224, 0.9);
}

.compact-login {
  min-height: 40px;
  padding: 0 16px;
}

.player-action-row {
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid #ffebbc;
  background: #fffaf0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.player-action-row .inline-transfer {
  min-height: 42px;
  margin-left: 12px;
  padding: 0 24px;
  white-space: nowrap;
  color: #ffffff;
  background: linear-gradient(180deg, #d87900 0%, #a64f00 100%);
  box-shadow: 0 12px 22px rgba(166, 79, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.inline-transfer-tip {
  flex: 0 0 auto;
  color: #9a783b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.service-ribbon {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  padding: 12px 20px;
  color: #7c5b21;
  background: #fff6d8;
  border-bottom: 1px solid #ffebbc;
  font-size: 13px;
  font-weight: 750;
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 22px;
  overflow: auto;
  background:
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.82)),
    radial-gradient(circle at 15% 30%, rgba(255, 206, 57, 0.2), transparent 26%);
}

.message-line {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.message-line.mine {
  flex-direction: row-reverse;
}

.message-line.mine .bubble {
  color: #472700;
  background: linear-gradient(180deg, #ffdc5c 0%, #ffc43a 100%);
}

.message-line.theirs .bubble {
  background: #ffffff;
}

.message-line.ai .avatar {
  color: #263a73;
  background: linear-gradient(180deg, #dfe7ff, #93a8ff);
}

.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: #6a3c00;
  background: linear-gradient(180deg, #fff4c8, #ffd462);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(180, 107, 0, 0.14);
}

.bubble {
  max-width: min(560px, 78%);
  padding: 13px 14px;
  border: 1px solid #ffedc4;
  border-radius: 18px;
  box-shadow: 0 12px 26px rgba(137, 82, 0, 0.08);
}

.message-meta {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #9a783b;
  font-size: 12px;
  font-weight: 780;
}

.bubble p {
  color: inherit;
  font-size: 14px;
  line-height: 1.7;
}

.contact-link-card {
  display: block;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #ffd477;
  border-radius: 16px;
  color: #5f3a00;
  background: #fff8df;
  text-decoration: none;
}

.contact-link-card span,
.contact-link-card strong {
  display: block;
}

.contact-link-card strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: #9a5a00;
  font-size: 12px;
}

.wechat-qr {
  display: block;
  width: min(220px, 100%);
  margin-top: 12px;
  border: 10px solid #ffffff;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(110, 70, 0, 0.16);
}

.empty-qr,
.upload-empty {
  margin-top: 10px;
  padding: 13px;
  border: 1px dashed #ffc257;
  border-radius: 16px;
  color: #8d6b31;
  background: #fffaf0;
  font-size: 13px;
  line-height: 1.5;
}

.ai-uncertain {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #ffd477;
  border-radius: 12px;
  color: #9a3f00;
  background: #fff3d3;
  font-size: 12px;
  font-weight: 850;
}

.quick-row {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 18px 0;
}

.quick-row button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #ffd477;
  border-radius: 999px;
  color: #704600;
  background: #fff7df;
  font-size: 14px;
  font-weight: 850;
}

.composer {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 16px 18px 20px;
}

.agent-contact-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid #ffebbc;
  background: #fffaf0;
}

.agent-contact-actions button {
  flex: 1 1 96px;
  min-height: 40px;
  white-space: nowrap;
}

.transfer-fixed {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 18px 0;
  border-top: 1px solid #ffebbc;
  background: #fffaf0;
}

.transfer-fixed .wide {
  width: auto;
  min-width: 180px;
  margin-top: 0;
}

.transfer-fixed span {
  color: #9a783b;
  font-size: 12px;
  font-weight: 800;
}

.composer input,
.login-card input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #ffd576;
  border-radius: 16px;
  padding: 0 15px;
  color: #392713;
  background: #fffdf6;
  outline: none;
}

.composer input:focus,
.login-card input:focus {
  border-color: #ffad16;
  box-shadow: 0 0 0 4px rgba(255, 183, 32, 0.18);
}

.info-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: 18px;
  overflow: auto;
}

.info-panel .agent-card {
  order: 5;
}

.info-panel .metrics {
  order: 6;
}

.info-panel .ai-suggestions {
  order: 1;
}

.info-panel .reply-manager {
  order: 2;
}

.info-panel .player-info-card {
  order: 3;
}

.info-panel .kb-status-card {
  order: 4;
}

.agent-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff0b8 0%, #fffaf0 100%);
}

.agent-logo {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 22px;
  color: #6b3f00;
  background: linear-gradient(180deg, #ffd83f, #ff9f19);
  font-weight: 1000;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5);
}

.agent-card p:last-child,
.record-note {
  margin-top: 6px;
  color: #795c2a;
  font-size: 13px;
  line-height: 1.65;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.metrics div {
  padding: 16px;
  border-radius: 20px;
  background: #fff8e5;
}

.metrics strong {
  display: block;
  color: #5c3300;
  font-size: 30px;
  line-height: 1;
}

.metrics span {
  color: #8d6b31;
  font-size: 13px;
  font-weight: 760;
}

.info-block {
  margin-top: 0;
  padding: 16px;
  border: 1px solid #ffedc4;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.source-profile {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0 14px;
  padding: 10px;
  border-radius: 17px;
  background: #fff8df;
}

.reply-manager {
  padding-bottom: 14px;
}

.ai-suggestions,
.reply-manager {
  background: linear-gradient(180deg, #fff8df 0%, #ffffff 100%);
  box-shadow: 0 12px 28px rgba(168, 103, 0, 0.08);
}

.reply-list {
  display: flex;
  max-height: 320px;
  min-height: 210px;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  overflow: auto;
}

.reply-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.reply-item button:first-child {
  min-height: 44px;
  border: 1px solid #ffd477;
  border-radius: 13px;
  padding: 8px 10px;
  color: #684300;
  background: #fff8df;
  text-align: left;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.4;
}

.reply-delete {
  min-height: 34px;
  border: 0;
  border-radius: 12px;
  padding: 0 9px;
  color: #9a3f00;
  background: #ffe4d4;
  font-size: 12px;
  font-weight: 820;
}

.reply-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.reply-form input {
  min-height: 38px;
  border: 1px solid #ffd576;
  border-radius: 13px;
  padding: 0 10px;
  background: #fffdf6;
  outline: none;
}

.reply-form .secondary-button {
  min-height: 38px;
  border-radius: 13px;
}

.reply-tip {
  margin-top: 8px;
  color: #9a783b;
  font-size: 12px;
  line-height: 1.5;
}

.ai-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.ai-form label {
  color: #73582b;
  font-size: 12px;
  font-weight: 850;
}

.ai-form input,
.ai-form textarea,
.ai-form select,
.knowledge-form input,
.knowledge-form textarea,
.knowledge-form select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #ffd576;
  border-radius: 13px;
  padding: 9px 10px;
  color: #392713;
  background: #fffdf6;
  outline: none;
}

.ai-form textarea {
  min-height: 74px;
  resize: vertical;
}

.knowledge-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.knowledge-form label {
  color: #73582b;
  font-size: 12px;
  font-weight: 850;
}

.knowledge-form textarea {
  min-height: 80px;
  resize: vertical;
}

.form-span-2 {
  grid-column: span 2;
}

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

.compact-list {
  max-height: 170px;
}

.knowledge-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  max-height: 520px;
  overflow: auto;
}

.bulk-import-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #cdd8ff;
  border-radius: 20px;
  background: linear-gradient(180deg, #f3f6ff, #ffffff);
}

.bulk-import-box strong {
  display: block;
  color: #263a73;
}

.bulk-import-box p {
  margin-top: 6px;
  color: #63709a;
  font-size: 13px;
  line-height: 1.55;
}

.bulk-import-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.bulk-import-form input,
.bulk-import-form select {
  width: 100%;
  border: 1px solid #cdd8ff;
  border-radius: 13px;
  padding: 9px 10px;
  background: #ffffff;
}

.question-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.question-summary span,
.list-more-tip {
  padding: 9px 11px;
  border-radius: 999px;
  color: #263a73;
  background: #eef3ff;
  font-size: 12px;
  font-weight: 850;
}

.list-more-tip {
  display: inline-block;
  margin-top: 12px;
  border-radius: 14px;
}

.upload-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: #fff8e5;
}

.upload-history strong {
  color: #5c3300;
}

.upload-history span {
  color: #73582b;
  font-size: 13px;
  line-height: 1.45;
}

.knowledge-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid #ffedc4;
  border-radius: 18px;
  background: #fffaf0;
}

.knowledge-row.platform-row {
  border-color: #ffd477;
  background: #fff8df;
}

.knowledge-row.game-row {
  border-color: #cdd8ff;
  background: #f6f8ff;
}

.knowledge-row strong {
  display: block;
  color: #5c3300;
  line-height: 1.45;
}

.knowledge-row p {
  margin-top: 6px;
  color: #73582b;
  font-size: 13px;
  line-height: 1.55;
}

.knowledge-row small {
  display: block;
  margin-top: 8px;
  color: #a48142;
  font-weight: 800;
  line-height: 1.45;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.row-actions .secondary-button,
.row-actions .reply-delete {
  min-height: 34px;
  white-space: nowrap;
}

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

.toggle-line input {
  width: auto;
  margin: 0;
}

.suggestion-list {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.suggestion-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.suggestion-list button {
  border: 1px solid #cdd8ff;
  border-radius: 14px;
  padding: 12px;
  color: #263a73;
  background: linear-gradient(180deg, #f3f6ff, #ffffff);
  text-align: left;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.5;
}

.suggestion-list .mini-send {
  white-space: nowrap;
  color: #5f3a00;
  background: #fff3c5;
  border-color: #ffd477;
}

.reply-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) 1fr;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.reply-toolbar input {
  width: 100%;
  border: 1px solid #ffd576;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fffdf6;
}

.reply-toolbar span {
  color: #9a783b;
  font-size: 13px;
  line-height: 1.45;
}

.settings-page {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  width: 100%;
  max-width: 1660px;
  min-height: 0;
  margin: 0 auto;
  overflow: auto;
}

.settings-side {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.settings-side-title {
  padding: 8px 4px 12px;
  border-bottom: 1px solid #ffedc4;
}

.settings-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.settings-current-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px 20px;
}

.settings-current-head span {
  padding: 8px 12px;
  border-radius: 999px;
  color: #704600;
  background: #fff0b0;
  font-size: 13px;
  font-weight: 850;
}

.settings-layer-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-nav-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-layer-nav button {
  display: flex;
  min-height: 78px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 14px 16px;
  border: 1px solid rgba(255, 190, 52, 0.5);
  border-radius: 22px;
  color: #6f4a16;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 32px rgba(146, 88, 0, 0.1);
  text-align: left;
}

.settings-main-nav {
  min-height: 78px;
}

.settings-layer-nav button.active {
  border-color: #ffb21c;
  background: linear-gradient(180deg, #ffd84b 0%, #fff4c8 100%);
  color: #3a2600;
}

.settings-layer-nav strong {
  font-size: 18px;
  font-weight: 950;
}

.settings-layer-nav span {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.settings-sub-nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 2px 0 4px 16px;
  border-left: 2px solid #ffd06a;
  margin-left: 12px;
}

.settings-sub-nav button {
  min-height: 54px;
  border-radius: 14px;
  padding: 10px 14px;
  background: #fffaf0;
}

.settings-sub-nav button.active {
  border-color: #d87900;
  background: linear-gradient(180deg, #fff2c2 0%, #ffe19a 100%);
  box-shadow: inset 4px 0 0 #d87900;
}

.settings-sub-nav strong {
  font-size: 15px;
}

.settings-sub-nav span {
  margin-top: 3px;
  font-size: 12px;
}

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

.settings-hero p:not(.eyebrow),
.settings-copy {
  margin-top: 8px;
  color: #795c2a;
  line-height: 1.65;
}

.settings-note {
  min-width: 260px;
  padding: 16px;
  border-radius: 20px;
  color: #654300;
  background: #fff1bd;
}

.settings-note strong,
.settings-note span {
  display: block;
}

.settings-note span {
  margin-top: 6px;
  color: #7b5a1d;
  font-size: 13px;
  line-height: 1.5;
}

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

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

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

.provider-config-card {
  padding: 16px;
  border: 1px solid #ffe1a0;
  border-radius: 20px;
  background: rgba(255, 250, 240, 0.92);
}

.provider-config-card.active {
  border-color: #d87900;
  background: linear-gradient(180deg, #fff4c8 0%, #fffaf0 100%);
  box-shadow: inset 4px 0 0 #d87900;
}

.provider-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.provider-config-head strong {
  color: #3a2600;
  font-size: 18px;
  font-weight: 950;
}

.provider-config-head span {
  padding: 5px 10px;
  border-radius: 999px;
  color: #8a5600;
  background: #fff0bd;
  font-size: 12px;
  font-weight: 800;
}

.provider-fields {
  grid-template-columns: 1fr;
  gap: 10px;
}

.settings-card {
  padding: 20px;
}

.layer-card {
  background: linear-gradient(180deg, #fff4c8 0%, rgba(255, 255, 255, 0.9) 100%);
}

.layer-card h2 {
  color: #5c3300;
}

.setting-list {
  display: flex;
  max-height: 310px;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  overflow: auto;
}

.setting-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #ffedc4;
  border-radius: 16px;
  background: #fff9e9;
}

.setting-item span {
  color: #5d3c0b;
  font-size: 14px;
  font-weight: 820;
  line-height: 1.5;
}

.setting-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.setting-form input {
  min-height: 42px;
  border: 1px solid #ffd576;
  border-radius: 14px;
  padding: 0 12px;
  background: #fffdf6;
  outline: none;
}

.settings-qr-preview {
  width: 150px;
  height: 150px;
  object-fit: contain;
  padding: 10px;
  border: 1px solid #ffedc4;
  border-radius: 18px;
  background: #ffffff;
}

.knowledge-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  color: #6f4a16;
  background: #fff8e5;
}

.knowledge-status strong {
  color: #5c3300;
}

.knowledge-status span {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.sheet-checklist,
.rule-levels {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.sheet-checklist span,
.rule-levels span {
  padding: 8px 10px;
  border: 1px solid #ffd477;
  border-radius: 999px;
  color: #704600;
  background: #fff7df;
  font-size: 12px;
  font-weight: 820;
}

.vertical-rules {
  flex-direction: column;
  align-items: stretch;
}

.vertical-rules span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-radius: 14px;
}

.vertical-rules button {
  border: 0;
  border-radius: 999px;
  color: #9a3f00;
  background: #ffe4d4;
  font-weight: 900;
}

dl {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px 8px;
  margin: 10px 0 0;
  font-size: 14px;
}

dt {
  color: #9a783b;
}

dd {
  margin: 0;
  font-weight: 800;
}

.wide {
  width: 100%;
  margin-top: 16px;
}

.login-page {
  display: grid;
  min-height: calc(100vh - 125px);
  place-items: center;
}

.login-card {
  width: min(430px, calc(100vw - 38px));
  padding: 34px;
  border: 1px solid rgba(255, 190, 52, 0.5);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 80px rgba(146, 88, 0, 0.16);
}

.login-card img {
  width: 142px;
  height: auto;
  margin-bottom: 18px;
}

.login-card > p:not(.eyebrow) {
  margin: 10px 0 22px;
  color: #73582b;
  line-height: 1.7;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card label {
  color: #73582b;
  font-size: 13px;
  font-weight: 820;
}

.login-card label input {
  margin-top: 7px;
}

.form-error {
  padding: 11px 12px;
  border-radius: 14px;
  color: #a43300;
  background: #ffe4d5;
  font-size: 13px;
  font-weight: 760;
}

.hint {
  margin-top: 16px;
  padding: 12px;
  border-radius: 15px;
  color: #7b5a1d;
  background: #fff4ce;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #73582b;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .info-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 12px;
  }

  .topbar,
  .workspace,
  .composer,
  .settings-layer-nav {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 12px;
    border-radius: 20px;
    padding: 12px;
  }

  .app-shell:has(.service-home) {
    min-height: 100vh;
    padding: 14px 14px 86px;
  }

  .service-home {
    padding: 0;
  }

  .service-hero {
    min-height: calc(100vh - 112px);
    padding: 24px 20px;
    border-radius: 26px;
  }

  .home-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .home-brand img {
    width: 112px;
    height: 52px;
  }

  .home-brand h1 {
    font-size: 32px;
    line-height: 1.15;
  }

  .home-intro {
    margin-top: 18px;
    font-size: 15px;
  }

  .home-actions,
  .home-grid,
  .faq-card {
    display: none;
  }

  .mobile-consult-button {
    position: fixed;
    right: 14px;
    bottom: 14px;
    left: 14px;
    z-index: 20;
    display: block;
    min-height: 54px;
    border: 0;
    border-radius: 18px;
    color: #3d2600;
    background: linear-gradient(180deg, #ffd447 0%, #ffad18 100%);
    box-shadow: 0 16px 34px rgba(211, 126, 0, 0.28);
    font-weight: 900;
  }

  .topbar:has(+ .player-workspace) {
    display: none;
  }

  .player-workspace {
    min-height: calc(100vh - 24px);
  }

  .player-chat-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .compact-brand img {
    width: 82px;
    height: 38px;
  }

  .compact-brand h2 {
    font-size: 24px;
  }

  .player-chat-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .compact-meta {
    width: 100%;
    justify-content: center;
  }

  .compact-login {
    width: 100%;
  }

  .player-action-row {
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .player-action-row button {
    flex: 0 0 auto;
  }

  .player-action-row .inline-transfer {
    margin-left: 0;
  }

  .inline-transfer-tip {
    display: none;
  }

  .brand img {
    width: 88px;
    height: 42px;
  }

  h1 {
    font-size: 24px;
  }

  .workspace {
    gap: 12px;
    overflow: visible;
  }

  .panel {
    border-radius: 22px;
  }

  .service-meta,
  .service-ribbon {
    flex-wrap: wrap;
    border-radius: 18px;
    white-space: normal;
  }

  .transfer-fixed {
    flex-wrap: wrap;
  }

  .conversation-list,
  .chat-panel {
    min-height: auto;
    height: auto;
  }

  .conversation-list {
    max-height: 260px;
  }

  .messages {
    height: 52vh;
    min-height: 320px;
  }

  .bubble {
    max-width: 86%;
  }

  .info-panel {
    height: auto;
    max-height: none;
  }

  .reply-form,
  .reply-item,
  .reply-toolbar,
  .suggestion-actions,
  .setting-form,
  .setting-item,
  .knowledge-form,
  .bulk-import-box,
  .settings-hero,
  .settings-page,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-side {
    min-height: auto;
  }

  .wide-card,
  .form-span-2 {
    grid-column: auto;
  }

  .settings-page {
    overflow: visible;
  }
}
