* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background: #f1f5f9;
}

#app {
    height: 100%;
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.tab:hover {
    background: rgba(255,255,255,0.3);
}

.tab.active {
    background: white;
    color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.card h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.9;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

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

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message.assistant .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

/* Markdown样式 */
.message-content.markdown {
    white-space: normal;
}

.message-content.markdown h1,
.message-content.markdown h2,
.message-content.markdown h3,
.message-content.markdown h4 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.message-content.markdown h1 {
    font-size: 1.5em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.3em;
}

.message-content.markdown h2 {
    font-size: 1.3em;
}

.message-content.markdown h3 {
    font-size: 1.1em;
}

.message-content.markdown h4 {
    font-size: 1em;
}

.message-content.markdown p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.message-content.markdown ul,
.message-content.markdown ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-content.markdown li {
    margin: 0.25em 0;
}

.message-content.markdown code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content.markdown pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.message-content.markdown pre code {
    background: none;
    padding: 0;
    display: block;
}

.message-content.markdown blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1em;
    margin: 0.5em 0;
    color: #666;
    font-style: italic;
}

.message-content.markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}

.message-content.markdown table th,
.message-content.markdown table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.message-content.markdown table th {
    background: #f5f5f5;
    font-weight: 600;
}

.message-content.markdown a {
    color: #667eea;
    text-decoration: none;
}

.message-content.markdown a:hover {
    text-decoration: underline;
}

.message-content.markdown hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1em 0;
}

.message.user .message-content.markdown code {
    background: rgba(255, 255, 255, 0.2);
}

.message.user .message-content.markdown pre {
    background: rgba(255, 255, 255, 0.15);
}

.message-time {
    font-size: 0.75em;
    color: #999;
    margin-top: 5px;
}

.message-body {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.message-body .message-content {
    max-width: 100%;
}

.msg-expand-btn {
    padding: 0 4px;
    font-size: 12px;
}

/* 消息全屏放大弹窗 */
.message-fullscreen-dialog .el-dialog__body {
    padding: 20px;
    overflow: auto;
    max-height: calc(100vh - 120px);
    background: #f8f9fa;
}

.message-fullscreen-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    min-height: 200px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message-fullscreen-content.markdown {
    white-space: normal;
}

.message-fullscreen-content.markdown h1,
.message-fullscreen-content.markdown h2,
.message-fullscreen-content.markdown h3,
.message-fullscreen-content.markdown h4 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.message-fullscreen-content.markdown pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    resize: none;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: opacity 0.3s;
}

.send-btn:hover {
    opacity: 0.9;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.typing-indicator {
    display: none;
    padding: 10px;
    color: #666;
    font-style: italic;
}

.typing-indicator.active {
    display: block;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
}

/* 智能体返回结果区域：上方工具栏含「放大查看」 */
.agent-result-block {
    margin-top: 15px;
}

.agent-result-toolbar {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 0;
    white-space: normal;
    font-size: 1em;
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.6;
}

/* Review结果的Markdown样式 */
.review-result.markdown h1,
.review-result.markdown h2,
.review-result.markdown h3,
.review-result.markdown h4 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #333;
}

.review-result.markdown h1 {
    font-size: 1.5em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.3em;
}

.review-result.markdown h2 {
    font-size: 1.3em;
}

.review-result.markdown h3 {
    font-size: 1.1em;
}

.review-result.markdown h4 {
    font-size: 1em;
}

.review-result.markdown p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.review-result.markdown ul,
.review-result.markdown ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.review-result.markdown li {
    margin: 0.25em 0;
}

.review-result.markdown code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.review-result.markdown pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.review-result.markdown pre code {
    background: none;
    padding: 0;
    display: block;
}

.review-result.markdown blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1em;
    margin: 0.5em 0;
    color: #666;
    font-style: italic;
}

.review-result.markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}

.review-result.markdown table th,
.review-result.markdown table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.review-result.markdown table th {
    background: #f5f5f5;
    font-weight: 600;
}

.review-result.markdown a {
    color: #667eea;
    text-decoration: none;
}

.review-result.markdown a:hover {
    text-decoration: underline;
}

.review-result.markdown hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1em 0;
}

/* 提示词管理 Sheet 页：上方 Tab 切换 */
.prompt-sheet-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}
.prompt-sheet-tab {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: #f5f5f5;
    color: #555;
    cursor: pointer;
    font-size: 1em;
    margin-bottom: -2px;
    transition: background 0.2s, color 0.2s;
}
.prompt-sheet-tab:hover {
    background: #eee;
    color: #333;
}
.prompt-sheet-tab.active {
    background: white;
    color: #667eea;
    font-weight: 600;
    border-color: #e0e0e0;
    border-bottom: 2px solid white;
}
.prompt-sheet-body {
    margin-top: 0;
}

/* 用户管理表格 */
.table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th,
.data-table td {
    border: 1px solid #e0e0e0;
    padding: 10px 12px;
    text-align: left;
}
.data-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}
.data-table tr:hover {
    background: #fafafa;
}
.data-table .btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
    margin-right: 6px;
    margin-bottom: 4px;
}
.data-table .btn-danger {
    background: #dc3545;
    color: white;
}
.data-table .btn-secondary {
    background: #6c757d;
    color: white;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}
.modal.show {
    display: flex;
}
.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 440px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.modal-close {
    position: absolute;
    right: 16px;
    top: 12px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}
.modal-close:hover {
    color: #333;
}

/* 头部白色描边按钮 */
.btn-outline-white {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
}
.btn-outline-white:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Vue 应用布局：铺满视窗，仅主内容区滚动 */
.app-layout {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: row;
  background: #f1f5f9;
  overflow: hidden;
}
.sidebar-and-picker {
  display: flex;
  flex-shrink: 0;
  height: 100%;
}
.app-layout .el-container {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-aside {
  background: #1e293b !important;
  height: 100% !important;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* 一级菜单旁的抽屉：紧贴侧栏滑出，鼠标移出菜单区域自动关闭 */
.picker-drawer {
  width: 0;
  overflow: hidden;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 4px 0 12px rgba(0,0,0,0.06);
  transition: width 0.25s ease;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.picker-drawer.open {
  width: 320px;
}
.picker-drawer-inner {
  width: 320px;
  min-width: 320px;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
}
.picker-drawer-title {
  font-size: 1.05em;
  font-weight: 600;
  color: #334155;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}
.app-aside .logo {
  height: 56px;
  line-height: 56px;
  text-align: center;
  color: #e2e8f0;
  font-weight: 600;
  font-size: 1.1em;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.app-menu {
  border-right: none !important;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.app-menu .el-menu-item {
  height: 48px;
  line-height: 48px;
}
.menu-icon {
  margin-right: 8px;
  font-size: 1.1em;
}
.app-header {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  height: 56px;
}
.app-sub-nav {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 20px;
}
.sub-nav-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.sub-nav-tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  color: #64748b;
  text-decoration: none;
  font-size: 0.95em;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
  cursor: pointer;
}
.sub-nav-tab:hover {
  color: #334155;
}
.sub-nav-tab.active {
  color: #667eea;
  font-weight: 500;
  border-bottom-color: #667eea;
}
.sub-nav-icon {
  margin-right: 6px;
  font-size: 1.05em;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}
.tab-label-wrap {
  display: inline-flex;
  align-items: center;
  padding: 2px 4px;
  margin: -2px -4px;
}
.tab-label-wrap .sub-nav-icon {
  flex-shrink: 0;
}
/* 浏览器页签栏（el-tabs card）内的图标 */
.app-sub-nav .el-tabs__item .sub-nav-icon,
.layout-user-tabs-wrap .el-tabs__item .sub-nav-icon {
  margin-right: 6px;
  font-size: 1.1em;
}

/* Sheet 页签右键菜单 */
.tab-context-menu-overlay {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1999;
}
.tab-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 120px;
  padding: 4px 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border: 1px solid #e2e8f0;
}
.tab-context-menu-item {
  padding: 8px 14px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}
.tab-context-menu-item:hover {
  background: #f1f5f9;
  color: #667eea;
}

/* HomeView（二级菜单选择页） */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.home-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  background: #fff;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.home-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.home-card-icon {
  font-size: 1.6em;
  margin-bottom: 8px;
}
.home-card-title {
  font-weight: 600;
  color: #334155;
}
.header-title {
  font-size: 1.1em;
  color: #334155;
  font-weight: 500;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-actions .username {
  color: #64748b;
  font-size: 0.95em;
}
.app-main {
  flex: 1;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}
.page-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.page-title {
  color: #334155;
  margin-bottom: 8px;
  font-size: 1.35em;
}
.page-desc {
  color: #64748b;
  margin-bottom: 20px;
  font-size: 0.95em;
  line-height: 1.5;
}

/* 登录页：铺满视窗，无滚动条 */
.login-page {
  height: 100vh;
  min-height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-title {
  text-align: center;
  color: #334155;
  margin-bottom: 8px;
  font-size: 1.75em;
}
.login-desc {
  text-align: center;
  color: #64748b;
  margin-bottom: 28px;
  font-size: 0.95em;
}
.success-msg {
  color: #16a34a;
  font-size: 0.9em;
  margin-top: 12px;
}
.error-msg {
  color: #dc2626;
  font-size: 0.9em;
  margin-top: 12px;
}

/* 菜单管理：头行结构（一级为头、二级为子行） */
.menu-toolbar {
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
}
.menu-tree-table tr.menu-header-row td {
  background: #f1f5f9 !important;
  font-weight: 600;
  color: #334155;
}
.menu-tree-table .menu-row-header {
  font-weight: 600;
}
.menu-tree-table .menu-icon {
  margin-right: 6px;
  font-size: 1.05em;
}

/* 角色管理：头行结构 */
.role-toolbar {
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
}
.role-head-row-table .role-head-name {
  font-weight: 600;
  color: #334155;
}
.role-head-row-table .role-row-muted {
  color: #94a3b8;
  font-size: 0.9em;
}

/* ========== 非超级用户布局（AI 助手风格：仅顶部二级菜单，可切换不可关闭） ========== */
.app-loading {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1em;
}

.layout-user {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
}

.layout-user-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.layout-user-title {
  font-weight: 700;
  font-size: 1.25em;
  color: #0f172a;
  white-space: nowrap;
}

.layout-user-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  padding: 0 8px;
}

.layout-user-nav.loading,
.layout-user-nav.empty {
  color: #94a3b8;
  font-size: 0.9em;
}

.layout-user-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  white-space: nowrap;
  border-radius: 8px;
  color: #64748b;
  text-decoration: none;
  font-size: 0.95em;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.layout-user-nav-item:hover {
  background: #f1f5f9;
  color: #334155;
}

.layout-user-nav-item.active {
  background: #e0e7ff;
  color: #4338ca;
  font-weight: 500;
}

.layout-user-nav .nav-item-icon {
  font-size: 1.1em;
}

.layout-user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.layout-user-actions .username {
  color: #64748b;
  font-size: 0.9em;
}

.layout-user-actions .btn-link {
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  font-size: 0.9em;
  padding: 0;
}

.layout-user-actions .btn-link:hover {
  text-decoration: underline;
}

.layout-user-tabs-wrap {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 20px;
}
.layout-user-tabs-wrap .sub-nav-icon {
  margin-right: 6px;
  font-size: 1.1em;
}

.layout-user-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
}

/* 审计 - 智能体使用历史 */
.audit-toolbar {
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.audit-pagination {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}
