/* Qme - 现代简洁设计 */

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

:root {
    /* 参考 Linear、Notion、Arc 等现代 SaaS 产品的配色 */

    /* 背景色 */
    --bg-body: #ffffff;
    --bg-surface: #f9f9f9;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-hover: #f3f3f3;
    --bg-active: #e8e8e8;

    /* 文字色 */
    --text-primary: #111111;
    --text-secondary: #666666;
    --text-tertiary: #999999;

    /* 主色 - 柔和蓝色 */
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --primary-light: #e6f0ff;

    /* 功能色 - 柔和版 */
    --success: #059669;
    --success-bg: rgba(208, 250, 229, 0.8);
    --warning: #d97706;
    --warning-bg: rgba(254, 243, 199, 0.8);
    --danger: #dc2626;
    --danger-bg: rgba(254, 226, 226, 0.8);

    /* 边框 */
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.12);

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* 圆角 - 按钮全圆角，卡片常规圆角 */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 100px;
    --radius-card: 12px;

    /* 间距 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-lg);
    width: 100%;
}

/* ========== 登录页 ========== */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

#login-page .container {
    max-width: 400px;
    padding: var(--space-lg);
}

/* Logo */
.logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.logo h1 {
    font-size: 36px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.5px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ========== 卡片 ========== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-xl);
    border: 1px solid var(--border);
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: 15px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

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

.form-group small {
    display: block;
    margin-top: var(--space-sm);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

/* ========== 按钮 ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: rgba(0, 102, 204, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
}

.btn-primary:hover {
    background: rgba(0, 82, 163, 0.9);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.95);
}

.btn-small {
    padding: 6px 14px;
    font-size: 14px;
}

.btn-danger {
    background: rgba(220, 38, 38, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
}

.btn-danger:hover {
    background: rgba(185, 28, 28, 0.9);
}

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

/* ========== 消息提示 ========== */
.message {
    margin-top: var(--space-md);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: none;
}

.message.error {
    background: var(--danger-bg);
    color: #991b1b;
    display: block;
}

.message.success {
    background: var(--success-bg);
    color: #065f46;
    display: block;
}

/* ========== 导航栏 ========== */
.navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

#user-nickname {
    color: var(--text-secondary);
    font-size: 14px;
}

#logout-btn {
    padding: 6px 14px;
    font-size: 14px;
}

/* ========== 标签页 ========== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    background: rgba(249, 249, 249, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 8px 0 8px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    position: relative;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.8);
}

.tab.active {
    background: rgba(0, 102, 204, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    box-shadow: 0 -2px 8px rgba(0, 102, 204, 0.2);
}

/* 内容区域连接标签 */
.tabs + .tab-content,
.tabs + .list-container,
.tabs + * {
    background: var(--bg-card);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-top: none;
}

/* ========== 页面头部 ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.page-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-header .btn {
    padding: 8px 16px;
    font-size: 14px;
}

/* ========== 列表容器 ========== */
.list-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* ========== 列表项 ========== */
.list-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease;
}

.list-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.list-item-info h4 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.list-item-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.list-item-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ========== 状态标签 ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.status-badge.enabled {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.disabled {
    background: rgba(232, 232, 232, 0.6);
    color: var(--text-secondary);
}

.status-badge.valid {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.invalid {
    background: var(--danger-bg);
    color: var(--danger);
}

.status-badge.unknown {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-badge.active {
    background: var(--success-bg);
    color: var(--success);
}

/* ========== 模态框 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
}

.modal-content {
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.close-btn:hover {
    background: var(--bg-hover);
}

.modal-body {
    padding: 0;
}

.modal-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-lg) 0;
}

.modal-body h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

/* ========== 任务编辑器（全屏模式） ========== */
.task-editor-modal {
    align-items: stretch;
    justify-content: stretch;
    padding: 10px;
    background: rgba(10, 14, 23, 0.55);
}

.task-editor-content {
    max-width: none;
    width: 100%;
    height: calc(100vh - 20px);
    max-height: none;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.task-editor-content .modal-header {
    margin-bottom: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.task-editor-content .modal-body {
    flex: 1 1 auto;
    overflow: hidden;
    padding-right: 0;
    margin-right: 0;
}

.task-editor-content #trigger-form {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-editor-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 360px;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
}

.task-editor-pane {
    min-height: 0;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    overflow: auto;
}

.task-editor-pane-left { grid-column: 1; grid-row: 1; }
.task-editor-pane-center { grid-column: 2; grid-row: 1; background: rgba(248, 250, 252, 0.82); }
.task-editor-pane-right { grid-column: 3; grid-row: 1; }
.task-editor-pane-bottom { grid-column: 1 / 4; grid-row: 2; padding: 10px 12px; }

.task-pane-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

.task-editor-right-hint,
.task-editor-bottom-hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    background: rgba(255,255,255,0.5);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

#task-node-inspector {
    display: grid;
    gap: 10px;
    position: sticky;
    top: 0;
}

.task-node-inspector-empty {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.55);
    border: 1px dashed rgba(148,163,184,0.35);
}

.task-node-inspector-card {
    border-radius: 12px;
    border: 1px solid rgba(148,163,184,0.2);
    background: rgba(255,255,255,0.78);
    padding: 10px;
    display: grid;
    gap: 10px;
}

.task-node-inspector-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.task-node-inspector-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.task-node-inspector-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.task-node-inspector-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.task-node-inspector-section {
    border-top: 1px solid rgba(148,163,184,0.16);
    padding-top: 8px;
}

.task-node-inspector-section-title {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.task-node-inspector-io {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.task-node-inspector-arrow {
    color: var(--text-secondary);
    font-size: 12px;
}

.task-node-inspector-params {
    display: grid;
    gap: 6px;
}

.task-node-inspector-row {
    display: grid;
    grid-template-columns: 8px 1fr;
    gap: 8px;
    align-items: start;
}

.task-node-inspector-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    margin-top: 5px;
    background: rgba(148,163,184,0.6);
}

.task-node-inspector-dot.ok {
    background: rgba(59,130,246,0.8);
}

.task-node-inspector-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.task-node-inspector-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.task-editor-pane .form-group {
    margin-bottom: 12px;
}

#task-start-node-card {
    margin-bottom: 12px;
}

.start-node-config-card {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(to bottom, rgba(255,255,255,0.82), rgba(248,250,252,0.92));
    padding: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}

.start-node-config-card.selected {
    border-color: rgba(59,130,246,0.28);
    background: linear-gradient(to bottom, rgba(239,246,255,0.95), rgba(248,250,252,0.95));
    box-shadow: 0 0 0 2px rgba(59,130,246,0.08), inset 0 1px 0 rgba(255,255,255,0.55);
}

.start-node-config-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.start-node-config-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.start-node-config-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.start-node-config-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.workflow-mini-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255,255,255,0.68);
    color: var(--text-secondary);
    font-size: 11px;
}

.workflow-mini-chip.warn {
    border-color: rgba(239, 68, 68, 0.22);
    background: rgba(254, 242, 242, 0.9);
    color: #b91c1c;
}

.task-editor-pane-center #task-actions-summary {
    margin: 0 !important;
    padding: 10px !important;
    background: transparent !important;
    border-radius: 0 !important;
}

.workflow-canvas-board {
    padding: 12px;
    border-radius: 14px;
    background:
        radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.72), rgba(248,250,252,0.78));
    background-size: 16px 16px, auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
    overflow-x: auto;
}

.workflow-canvas-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: max-content;
    padding: 6px 4px;
}

.workflow-empty-next {
    min-width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 44px;
}

.workflow-empty-tip {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.5);
    border: 1px dashed rgba(148,163,184,0.35);
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    max-width: 240px;
}

.task-editor-content .form-actions {
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding-bottom: 8px;
}

@media (max-width: 1180px) {
    .task-editor-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(280px, 1fr) auto auto;
    }

    .task-editor-pane-left,
    .task-editor-pane-center,
    .task-editor-pane-right,
    .task-editor-pane-bottom {
        grid-column: 1;
    }

    .task-editor-pane-left { grid-row: 1; }
    .task-editor-pane-center { grid-row: 2; }
    .task-editor-pane-right { grid-row: 3; }
    .task-editor-pane-bottom { grid-row: 4; }
}

/* ========== 表头预览 ========== */
.headers-preview {
    margin: var(--space-md) 0;
    padding: var(--space-md);
    background: var(--success-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-card);
}

.headers-preview p {
    margin-bottom: var(--space-sm);
    font-size: 14px;
    font-weight: 500;
    color: #065f46;
}

#headers-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.header-tag {
    display: inline-flex;
    padding: 4px 12px;
    background: white;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

/* ========== 表单操作按钮 ========== */
.form-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.form-actions .btn {
    flex: 1;
}

/* ========== 字段配置列表 ========== */
.field-configs-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-sm);
    background: rgba(249, 249, 249, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
}

.field-config-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.field-config-item .field-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.field-config-item .checkbox-group {
    display: flex;
    gap: var(--space-md);
}

.field-config-item .checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-config-item input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.field-config-item .checkbox-item label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

/* ========== 字段 Toggle 按钮 ========== */
.field-toggle {
    padding: 4px 10px;
    background: rgba(0, 102, 204, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}

.field-toggle.inactive {
    background: rgba(153, 153, 153, 0.6);
}

.field-toggle:hover {
    opacity: 0.85;
}

/* ========== 返回范围日期输入 ========== */
.range-inputs-group {
    display: none;
    gap: var(--space-md);
}

.range-inputs-group.show {
    display: flex;
}

.range-inputs-group .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

.empty-state p {
    font-size: 15px;
}

/* ========== LLM 配置列表 ========== */
.configs-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.config-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease;
}

.config-item.active {
    border-color: var(--primary);
    border-width: 2px;
}

.config-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.config-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.config-provider-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.config-info h4 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
}

.config-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.config-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    text-decoration: none;
}

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

.config-actions {
    display: flex;
    gap: var(--space-sm);
}

.hint {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: var(--space-md);
}

/* ========== 脚本预览 ========== */
#script-content {
    max-height: 400px;
    overflow-y: auto;
    background: rgba(249, 249, 249, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

#script-modal .modal-content {
    max-width: 640px;
}

ol {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

ol li {
    margin-bottom: var(--space-xs);
}

code {
    background: var(--bg-active);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-primary);
}

/* ========== Toast 消息提示 ========== */
.toast {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    min-width: 280px;
    max-width: 360px;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    transform: translateX(calc(100% + var(--space-lg)));
    transition: transform 0.3s ease;
    border-left: 3px solid;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.info {
    border-left-color: var(--primary);
}

/* ========== 测试结果区域 ========== */
#test-result {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(249, 249, 249, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

#test-result h5 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

#test-result-content {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========== 返回配置区域 ========== */
#return-config {
    background: rgba(249, 249, 249, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
}

#return-config h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .container {
        padding: var(--space-md);
    }

    .glass-card {
        padding: var(--space-lg);
    }

    .logo h1 {
        font-size: 32px;
    }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .list-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .config-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .config-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .modal {
        padding: var(--space-md);
    }

    .toast {
        right: var(--space-md);
        left: var(--space-md);
        min-width: auto;
    }
}

/* ========== QQ 登录按钮 ========== */
.btn-qq-login {
    background: #12B7F5;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    max-width: 300px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.btn-qq-login:hover {
    background: #0DA8E2;
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.btn-qq-login:active {
    transform: translateY(0);
}

/* ========== 群权限管理页面 ========== */
.groups-container {
    display: flex;
    gap: var(--space-lg);
    min-height: 400px;
}

.groups-sidebar {
    width: 240px;
    flex-shrink: 0;
}

.groups-sidebar h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.groups-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.group-item {
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.group-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border-strong);
}

.group-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.group-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.group-item-name-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 4px;
    margin: -2px -4px 2px -4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 6px;
}

.group-item-name-input::placeholder {
    color: var(--text-tertiary);
    font-weight: 500;
}

.group-item-name-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.9);
}

.group-item-name-fallback {
    margin-top: 2px;
}

.group-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.groups-main {
    flex: 1;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border);
}

.group-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.group-detail-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-mode-selector {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-mode-selector select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
}

.auth-mode-selector select:focus {
    outline: none;
    border-color: var(--primary);
}

.members-section {
    margin-top: var(--space-lg);
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.ui-switch {
    position: relative;
    display: inline-flex;
    width: 46px;
    height: 28px;
    flex-shrink: 0;
}

.ui-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ui-switch-slider {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.14);
    border-radius: 999px;
    transition: 0.18s ease;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.ui-switch-slider::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: 0.18s ease;
}

.ui-switch input:checked + .ui-switch-slider {
    background: rgba(5, 150, 105, 0.9);
}

.ui-switch input:checked + .ui-switch-slider::before {
    transform: translateX(18px);
}

.ui-switch input:focus-visible + .ui-switch-slider {
    outline: 2px solid rgba(0, 102, 204, 0.45);
    outline-offset: 2px;
}

.members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.members-header h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.9);
}

.member-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.member-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.member-openid {
    font-size: 12px;
    color: var(--text-tertiary);
}

.member-badge {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
}

.member-badge.allowed {
    background: var(--success-bg);
    color: var(--success);
}

.member-badge.blocked {
    background: var(--danger-bg);
    color: var(--danger);
}

.member-actions {
    display: flex;
    gap: var(--space-sm);
}

/* 空状态 */
.empty-groups {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.empty-groups-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

.empty-groups p {
    font-size: 14px;
    line-height: 1.6;
}

/* 添加成员弹窗 */
.add-member-form .form-group {
    margin-bottom: var(--space-md);
}

.add-member-form label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.add-member-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.add-member-form small {
    display: block;
    margin-top: var(--space-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 768px) {
    .groups-container {
        flex-direction: column;
    }

    .groups-sidebar {
        width: 100%;
    }

    .groups-list {
        max-height: 200px;
        overflow-y: auto;
    }

    .group-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }


    .members-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
}
