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

:root {
    --primary-color: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #1e1b4b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-color: #f8fafc;
    --dark-color: #1e1b4b;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --bg-color: #f1f5f9;
    --sidebar-width: 280px;
    --header-height: 64px;
    --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    --sidebar-text: #e2e8f0;
    --sidebar-muted: #94a3b8;
    --menu-active-bar: #818cf8;
    --card-radius: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* ========== SIDEBAR - 左侧菜单 ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.sidebar-header .brand-sub {
    font-size: 11px;
    color: var(--sidebar-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.7;
}

.menu-search {
    padding: 16px 20px;
    position: relative;
}

.menu-search::before {
    content: '🔍';
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

.menu-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: none;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.menu-search input::placeholder {
    color: var(--sidebar-muted);
}

.menu-search input:focus {
    background-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.4);
}

/* 菜单分组标题 */
.menu-group-title {
    padding: 16px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-muted);
    opacity: 0.6;
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* 菜单项 */
.menu-item {
    padding: 11px 20px 11px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
    position: relative;
    color: var(--sidebar-text);
    font-size: 14px;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.menu-item.active {
    background-color: rgba(129, 140, 248, 0.15);
    color: white;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--menu-active-bar);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px var(--menu-active-bar);
}

.menu-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.menu-title {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-arrow {
    font-size: 11px;
    opacity: 0.4;
    flex-shrink: 0;
}

/* 菜单分隔线 */
.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 20px;
}

/* 最近访问区域 */
.recent-menu-section {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.recent-menu-section h3 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-muted);
    opacity: 0.7;
    margin-bottom: 10px;
    font-weight: 600;
}

.recent-menu-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recent-menu-item {
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--sidebar-text);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.recent-menu-item::before {
    content: '⏱';
    font-size: 11px;
    opacity: 0.5;
}

/* ========== 角色使用场景页面（右侧工作区） ========== */
.scenario-page {
    padding: 24px 32px;
    max-width: 1400px;
}

.scenario-page-header {
    margin-bottom: 20px;
}

.scenario-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scenario-page-desc {
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
}

.scenario-page-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 22px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.scenario-page-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 18px;
    padding-left: 10px;
    border-left: 3px solid #6366f1;
}

/* 场景下无可用模块时的空状态 */
.scenario-page-empty {
    padding: 28px 8px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* 场景切换条：在场景页顶部直接切换应用场景（手机端无需展开左侧菜单再滚动查找） */
.scenario-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
}

.scenario-switch-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
    color: #374151;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scenario-switch-item:hover {
    border-color: #6366f1;
    color: #4338ca;
}

.scenario-switch-item.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.scenario-switch-icon {
    font-size: 16px;
}

.scenario-switch-text {
    white-space: nowrap;
}

/* 蛇形折行流程：第一行左→右，换行右→左，交替；行间用向下箭头连接 */
.scenario-flow-wrap {
    padding: 6px 0 4px;
}

.scenario-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.scenario-row {
    display: flex;
    align-items: center;
    gap: 0;
}

/* 两端锚定，使换行处的下行箭头能与首/末节点中心对齐 */
.scenario-row.ltr,
.scenario-row.rtl {
    justify-content: space-between;
}

/* 不足一整行的末行：靠起始侧紧排，避免两端对齐把箭头拉长 */
.scenario-row.partial.ltr {
    justify-content: flex-start;
}

.scenario-row.partial.rtl {
    justify-content: flex-end;
}

/* 流程单元：单个节点 或 并行分支组（统一 122px 宽，保证蛇形排布与换行箭头对齐） */
.scenario-unit {
    flex: 0 0 auto;
    width: 122px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* 并行分支：同一位置并列的多个可选/并行模块（虚线框标识）
   padding 10px：步骤徽标外突 9px，需大于 9px 才不会压到虚线边框 */
.scenario-branch {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px dashed #c7d2fe;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.04);
}

.scenario-branch .scenario-node {
    width: 100%;
}

/* 循环回环（同一行内）：U 形虚线弧，箭头指回目标节点底部 */
.loop-arc {
    position: absolute;
    height: 16px;
    border: 2px dashed #a5b4fc;
    border-top: none;
    border-radius: 0 0 10px 10px;
    pointer-events: none;
    z-index: 2;
}

.loop-arc.to-left::before,
.loop-arc.to-right::before {
    content: '';
    position: absolute;
    top: -7px;
    width: 0;
    height: 0;
}

.loop-arc.to-left::before {
    left: -6px;
    border-bottom: 8px solid #a5b4fc;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.loop-arc.to-right::before {
    right: -6px;
    border-bottom: 8px solid #a5b4fc;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.loop-arc .loop-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 2px;
    font-size: 10px;
    color: #6366f1;
    background: #eef2ff;
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
}

.scenario-row.has-loop {
    margin-bottom: 26px;
}

/* 循环回环（跨行）：源单元下方的回流徽标 */
.loop-badge {
    font-size: 10px;
    color: #6366f1;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 2px 6px;
    text-align: center;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scenario-node {
    flex: 0 0 auto;
    position: relative;
    width: 122px;
    min-height: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.scenario-node:hover {
    border-color: #818cf8;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.18);
    transform: translateY(-2px);
}

.scenario-node-step {
    position: absolute;
    top: -9px;
    left: -9px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

.scenario-node-icon {
    font-size: 26px;
    line-height: 1;
}

.scenario-node-label {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
}

.scenario-node-name {
    font-size: 11px;
    color: #94a3b8;
}

/* 带箭头的流程线段：一条横线 + 三角箭头 */
/* 行内带箭头线段：right=向右，left=向左 */
.scenario-arrow {
    flex: 0 0 auto;
    align-self: center;
    position: relative;
    width: 44px;
    height: 2px;
    background: #a5b4fc;
    margin: 0 2px;
}

.scenario-arrow.right::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #a5b4fc;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.scenario-arrow.left::after {
    content: '';
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-right: 8px solid #a5b4fc;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

/* 手机端纵向布局：节点从上到下居中竖排，向下箭头居中，不做蛇形折行 */
.scenario-flow.vertical {
    align-items: center;
}

.scenario-turn.turn-center {
    justify-content: center;
    padding: 0;
}

/* 手机端纵向布局下的并行分支组：单元占满可用宽度（给 grid 确定宽度，
   auto-fit 才能按实际可用宽算列数），排得下横排、排不下自动换行 */
.scenario-flow.vertical .scenario-unit.with-branch {
    width: 100%;
}

.scenario-flow.vertical .scenario-branch {
    display: grid;
    /* 注意：auto-fit + minmax(固定max) 在 Chromium 下会退化为 1 列，
       必须用 auto-fill + minmax(min, 1fr) 才能按可用宽度算出多列 */
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px 8px;
    width: 100%;
    box-sizing: border-box;
}

/* 节点在轨道内限宽居中（轨道可能宽于 122px） */
.scenario-flow.vertical .scenario-branch .scenario-node {
    width: 100%;
    max-width: 122px;
    justify-self: center;
}

/* 换行连接箭头：从当前行末端向下指向下一行首端 */
.scenario-turn {
    display: flex;
    height: 30px;
}

.scenario-turn.turn-right {
    justify-content: flex-end;
    padding-right: 60px;
}

.scenario-turn.turn-left {
    justify-content: flex-start;
    padding-left: 60px;
}

.scenario-turn .turn-line {
    position: relative;
    width: 2px;
    height: 100%;
    background: #a5b4fc;
}

.scenario-turn .turn-line::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid #a5b4fc;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

@media (max-width: 768px) {
    .scenario-page { padding: 16px; }
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    height: var(--header-height);
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-color);
    margin: 4px 0;
}

.header-left h2 {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-icon {
    position: relative;
    cursor: pointer;
    padding: 5px;
}

.notification-icon .icon {
    font-size: 24px;
}

.notification-icon .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    font-size: 12px;
    padding: 0;
    box-sizing: border-box;
}

/* 未读消息角标（hddchat）：主色，区别于未读邮件的红色 */
.chat-notification-icon .badge {
    background-color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.logout-btn {
    padding: 8px 18px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.logout-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
    z-index: 1;
}

.modal-body {
    padding: 30px;
}

.notification-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 350px;
    height: calc(100vh - var(--header-height));
    background-color: white;
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.notification-panel.active {
    transform: translateX(0);
}

.notification-panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.mark-all-read {
    padding: 5px 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
}

.notification-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.notification-item:hover {
    background-color: var(--light-color);
}

.notification-item.unread {
    background-color: rgba(52, 152, 219, 0.1);
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.notification-item-title {
    font-weight: 600;
    font-size: 14px;
}

.notification-item-time {
    font-size: 12px;
    color: #999;
}

.notification-item-content {
    font-size: 13px;
    color: #666;
}

.notification-item-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 5px;
}

.notification-item-type.system {
    background-color: var(--primary-color);
    color: white;
}

.notification-item-type.info {
    background-color: var(--success-color);
    color: white;
}

.notification-item-type.warning {
    background-color: var(--warning-color);
    color: white;
}

.notification-item-type.error {
    background-color: var(--danger-color);
    color: white;
}

.success-message {
    background-color: var(--success-color);
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

.success-message.active {
    display: block;
}

/* 页面内容样式 */
.page-content {
    background: var(--bg-color);
    border-radius: var(--card-radius);
    padding: 28px;
    min-height: calc(100vh - var(--header-height) - 40px);
}

.page-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* ====== 欢迎横幅 ====== */
.welcome-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
    border-radius: var(--card-radius);
    padding: 28px 32px;
    color: white;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.25);
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.welcome-banner h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.welcome-banner p {
    font-size: 14px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.welcome-banner .welcome-time {
    position: absolute;
    top: 20px;
    right: 28px;
    font-size: 12px;
    opacity: 0.7;
    font-weight: 500;
    z-index: 1;
}

/* ====== 快捷访问区域 ====== */
.quick-links {
    margin-top: 8px;
}

.quick-links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.quick-links-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-links-header h3::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
}

.quick-links .modules-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* ====== 模块大卡片 - 首页快捷按钮 ====== */
.module-card-large {
    flex: 0 0 calc(33.333% - 12px);
    min-width: 280px;
    max-width: calc(33.333% - 12px);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.module-card-large::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--module-color, var(--primary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.module-card-large:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    border-color: var(--module-color, var(--primary-color));
}

.module-card-large:hover::before {
    opacity: 1;
}

/* 常用模块突出显示 */
.module-card-large.frequent::before {
    opacity: 0.8;
}

.module-card-large.frequent .module-category {
    background: var(--module-color, var(--primary-color));
    color: white;
    font-weight: 500;
}

.module-card-large.frequent .frequent-badge {
    display: inline-block;
}

.module-card-large .frequent-badge {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 9px;
    padding: 2px 6px;
    background: var(--warning-color);
    color: white;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.module-icon-large {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--module-color, var(--primary-color)), color-mix(in srgb, var(--module-color, var(--primary-color)) 75%, white));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--module-color, var(--primary-color)) 30%, transparent);
    transition: transform 0.3s ease;
}

.module-card-large:hover .module-icon-large {
    transform: scale(1.05) rotate(-3deg);
}

.module-info-large {
    flex: 1;
    min-width: 0;
}

.module-info-large h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.module-info-large p {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.module-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-category {
    font-size: 11px;
    padding: 3px 10px;
    background: #f1f5f9;
    border-radius: 20px;
    color: #64748b;
    font-weight: 500;
}

.module-arrow {
    font-size: 16px;
    color: #cbd5e1;
    transition: all 0.3s ease;
}

.module-card-large:hover .module-arrow {
    color: var(--module-color, var(--primary-color));
    transform: translateX(4px);
}

/* 响应式 - 快捷按钮卡片 */
@media (max-width: 1200px) {
    .module-card-large {
        flex: 0 0 calc(50% - 8px);
        max-width: calc(50% - 8px);
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .module-card-large {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* 模块管理页面网格 */
.modules-page .modules-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

@media (max-width: 768px) {
    .modules-page .modules-grid .module-card-large {
        flex: 0 0 100%;
    }
}

/* 加载和错误状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #666;
}

.error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--danger-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-hint {
    font-size: 14px;
    color: #bbb;
    margin-top: 8px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--light-color);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: #4338ca;
}

/* 数据表格 */
.data-table {
    overflow-x: auto;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--text-color);
}

.data-table tr:hover {
    background: rgba(52, 152, 219, 0.05);
}

.empty-cell {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* 表单样式 */
.settings-form,
.form-group {
    max-width: 500px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control[readonly] {
    background: var(--light-color);
    cursor: not-allowed;
}

/* 个人资料卡片 */
.profile-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px;
    background: linear-gradient(135deg, var(--light-color), white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.profile-info h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.profile-info p {
    color: #666;
}

/* 配置列表 */
.config-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--light-color);
    border-radius: 8px;
}

.config-name {
    font-weight: 500;
    color: var(--text-color);
}

.config-value {
    color: #666;
}

.config-value.status-ok {
    color: var(--success-color);
    font-weight: 500;
}

/* 模块列表 */
.module-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.module-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.module-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.module-card .module-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.module-card .module-info {
    flex: 1;
}

.module-card .module-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.module-card .module-info p {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.module-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.module-link:hover {
    text-decoration: underline;
}

/* 模块管理页面 - 大卡片样式（已在上方定义 .modules-page .modules-grid） */

/* 旧样式已被上方的新 .module-card-large 样式替换 */

.module-card-large:hover .module-arrow {
    color: var(--module-color, var(--primary-color));
    transform: translateX(4px);
}

/* 仪表盘卡片 */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 14px;
    color: #666;
}

/* 快捷链接 */
.quick-links {
    margin-top: 32px;
}

.quick-links h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.quick-link-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.quick-link-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.quick-link-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.quick-link-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.quick-link-desc {
    font-size: 12px;
    color: #888;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: block;
    }

    /* 侧边栏遮罩：点击空白处收起菜单（由 app.js 动态创建） */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 999;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    /* 手机上场景切换条更紧凑，保证一屏可见多个场景 */
    .scenario-switcher {
        gap: 8px;
        margin-bottom: 14px;
    }

    .scenario-switch-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .notification-panel {
        width: 100%;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .user-name {
        display: inline-block;
        font-size: 12px;
    }
    
    .page-content {
        padding: 16px;
    }
    
    .dashboard-cards,
    .module-list,
    .quick-links-grid,
    .modules-page .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-card {
        flex-direction: column;
        text-align: center;
    }
    
    .toolbar {
        flex-wrap: wrap;
    }
    
    .module-card-large {
        padding: 20px;
    }
    
    .module-icon-large {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
}

/* 头像上传样式 */
.avatar-upload {
    padding: 20px 0;
}

.current-avatar-preview {
    text-align: center;
    margin-bottom: 24px;
}

.current-avatar-preview img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.avatar-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.upload-status {
    text-align: center;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
}

.upload-status.success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
}

.upload-status.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.upload-status.info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
}

/* Mobile devices */
@media (max-width: 768px) {
  body {
    font-size: 14px;
    padding: 10px;
  }
  .container {
    flex-direction: column;
    width: 100%;
    padding: 0 10px;
  }
  .nav-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .card {
    width: 100%;
    margin: 5px 0;
  }
}

/* Tablets and small desktops */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 960px;
  }
  .card {
    width: 48%;
    margin: 1%;
  }
}

/* Large screens */
@media (min-width: 1025px) {
  .container {
    max-width: 1200px;
  }
  .card {
    width: 30%;
    margin: 1.66%;
  }
}
/* QR Code Button */
.sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar-title-row h2 {
    margin-bottom: 0;
}

.qr-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: none;
    border: none;
    border-radius: 6px;
    color: #a5b4fc;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.15s;
    font-size: 0;
    line-height: 0;
}

.qr-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(1.1);
}

.qr-icon-btn:active {
    transform: scale(0.95);
}

/* QR Modal */
.qr-modal-content {
    background-color: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.qr-modal-body {
    padding: 0;
}

.qr-modal-body h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
}

.qr-modal-body #qrSvgContainer {
    margin: 0 auto 16px;
    display: block;
}

.qr-modal-body #qrSvgContainer img {
    width: 240px;
    height: 240px;
    display: block;
    margin: 0 auto;
    border: 4px solid var(--primary-color);
    border-radius: 8px;
}

.qr-modal-body .qr-url {
    font-size: 13px;
    color: var(--sidebar-muted);
    word-break: break-all;
    line-height: 1.5;
    padding: 10px 14px;
    background-color: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 8px;
}

.qr-modal-body .qr-hint {
    font-size: 12px;
    color: var(--sidebar-muted);
    margin-top: 12px;
}

.qr-modal-body .qr-version {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 10px;
    letter-spacing: 0.3px;
}

.qr-modal-body .qr-version.ready {
    animation: qrVersionFadeIn .25s ease-out;
}

@keyframes qrVersionFadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0); }
}

