/* 独立 Agent 页：API Key 门禁 + 全屏三栏（无管理后台侧栏） */

.agent-standalone {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

.agent-key-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.agent-key-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.06));
}

.agent-key-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
}

.agent-key-sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.agent-key-error {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--danger, #c62828);
  min-height: 1.2em;
}

.agent-key-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-standalone-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.agent-standalone-brand {
  font-size: 15px;
  font-weight: 600;
}

.agent-standalone-user {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-standalone-main {
  padding: 12px 16px 16px;
  min-height: 0;
  flex: 1;
}

#agent-app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#agent-app-screen.hidden {
  display: none;
}

.agent-key-screen.hidden {
  display: none;
}

/* 独立页无侧栏：取消体验中心负边距扩宽 */
.agent-standalone #panel-experience.experience-agent-active {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  max-width: none;
}

.agent-standalone #panel-experience.experience-agent-active .agent-layout {
  min-height: calc(100vh - 52px);
}

.agent-standalone .agent-chat-panel {
  min-height: calc(100vh - 80px);
  max-height: calc(100vh - 64px);
}

.agent-standalone #experience-agent-section {
  display: block;
}

.agent-standalone .agent-standalone-topbar + .agent-standalone-main .agent-chat-head {
  position: sticky;
  top: 0;
}

.agent-standalone .agent-chat-head {
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
}

.agent-standalone .agent-chat-head .agent-head-actions {
  margin-left: auto;
  flex-shrink: 0;
}

/* iframe 内嵌：用 100% 填满 iframe 视口，避免 100vh 在嵌套环境下高度异常 */
html.agent-embed,
html.agent-embed body.agent-standalone {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}

.agent-embed .agent-key-screen {
  min-height: 100%;
}

.agent-embed #agent-app-screen {
  min-height: 100%;
  max-height: 100%;
}

.agent-embed .agent-standalone-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.agent-embed .agent-standalone #panel-experience.experience-agent-active .agent-layout {
  min-height: 0;
  height: 100%;
}

.agent-embed .agent-standalone .agent-chat-panel {
  min-height: 0;
  max-height: none;
  height: 100%;
}

@media (max-width: 960px) {
  .agent-standalone-main {
    padding: 8px;
  }
  .agent-standalone #panel-experience.experience-agent-active .agent-layout {
    min-height: calc(100vh - 48px);
  }
}
