/* base.css — 访客端壳层：根容器、头部、消息区、输入区的布局骨架与基础排版。
   颜色/尺寸只引用 ../shared/tokens.css 的变量；组件外观在 components.css，页面状态与响应式在 pages.css。 */

html, body { height: 100%; }
body {
  font-size: var(--fs-chat);
  background: var(--bg-sunken);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: var(--brand-600); }

/* 根容器：移动端铺满视口；桌面独立页居中卡片（pages.css）；嵌入模式铺满 iframe */
.kf {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  min-height: 0;
  margin: 0 auto;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
@supports (height: 100dvh) { .kf { height: 100dvh; } }

/* 头部 */
.kf-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 0 0 auto;
  min-height: 64px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.kf-header-text { flex: 1 1 auto; min-width: 0; }
.kf-brand-name {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kf-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kf-status-dot {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--dur-fast) var(--ease);
}
.kf-status[data-state="online"] .kf-status-dot { background: var(--success); }
.kf-status[data-state="offline"] .kf-status-dot { background: var(--text-muted); }
.kf-status[data-state="connecting"] .kf-status-dot { background: var(--warning); }

/* 消息区 */
.kf-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.kf-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.kf-scroll:focus-visible { box-shadow: inset var(--focus-ring); }
.kf-scroll::-webkit-scrollbar { width: 6px; }
.kf-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
.kf-list { display: flex; flex-direction: column; gap: var(--sp-2); }

/* 输入区 */
.kf-composer {
  flex: 0 0 auto;
  padding: var(--sp-2) var(--sp-3);
  padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.kf-composer-row {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-1);
}
.kf-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: var(--h-icon-btn);
  padding: 0 var(--sp-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.kf-input-wrap:focus-within { border-color: var(--brand-500); box-shadow: var(--focus-ring); background: var(--surface); }
.kf-input {
  display: block;
  width: 100%;
  max-height: 128px;
  padding: 9px 0;
  margin: 0;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-size: var(--fs-chat);
  line-height: 1.4;
  color: var(--text);
  overflow-y: auto;
  scrollbar-width: thin;
}
.kf-input::placeholder { color: var(--text-muted); }
.kf-input:focus-visible { box-shadow: none; }

/* 通用文本工具 */
.kf-muted { color: var(--text-muted); }
.kf-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
