/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --accent-primary: #58a6ff;
    --accent-success: #3fb950;
    --accent-warning: #d29922;
    --accent-danger: #f85149;
    --accent-purple: #a371f7;
    
    --border-color: #30363d;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    
    --transition: all 0.2s ease;
    
    --sidebar-width: 240px;
    --header-height: 64px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ===== App Container ===== */
.app-container {
    min-height: 100vh;
}

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: flex;
}

/* ===== Auth Page ===== */
.auth-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background: var(--bg-primary);
}

/* Left brand panel */
.auth-brand {
    flex: 1 1 50%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 56px;
    background:
        radial-gradient(ellipse at 18% 22%, rgba(88, 166, 255, 0.28) 0%, transparent 55%),
        radial-gradient(ellipse at 82% 78%, rgba(163, 113, 247, 0.22) 0%, transparent 55%),
        linear-gradient(135deg, #0d1117 0%, #161b22 60%, #1c2235 100%);
    color: var(--text-primary);
    isolation: isolate;
}

.auth-brand-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.brand-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
}

.brand-shape-1 {
    width: 360px;
    height: 360px;
    background: rgba(88, 166, 255, 0.35);
    top: -80px;
    left: -100px;
}

.brand-shape-2 {
    width: 320px;
    height: 320px;
    background: rgba(163, 113, 247, 0.30);
    bottom: -60px;
    right: -80px;
}

.brand-shape-3 {
    width: 240px;
    height: 240px;
    background: rgba(63, 185, 80, 0.18);
    top: 50%;
    right: 20%;
    transform: translateY(-50%);
}

.brand-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.85) 0%, transparent 75%);
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-logo .logo-icon {
    font-size: 40px;
    filter: drop-shadow(0 0 12px rgba(88, 166, 255, 0.55));
}

.brand-logo-text {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-headline {
    font-size: 34px;
    line-height: 1.35;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.brand-sub {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 36px;
    max-width: 440px;
}

.brand-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand-features li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius);
    backdrop-filter: blur(6px);
    transition: var(--transition);
}

.brand-features li:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(88, 166, 255, 0.35);
    transform: translateX(2px);
}

.brand-feature-icon {
    font-size: 22px;
    line-height: 1;
    flex: none;
    margin-top: 2px;
}

.brand-features li > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-features li strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.brand-features li span:not(.brand-feature-icon) {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Right auth panel */
.auth-panel {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--bg-primary);
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 36px;
    filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.5));
}

.logo h1 {
    font-size: 26px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: var(--transition);
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.auth-form .btn-primary {
    width: 100%;
}

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

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

.label-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.label-with-action label {
    margin-bottom: 0;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

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

/* 通用表单控件暗色样式：覆盖 input / select / textarea，与所在弹窗的暗色主题保持一致。
   原本 select 没有暗色规则，会回落到浏览器默认的白底，造成弹窗内观感割裂。 */
.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

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

.form-input:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* select 还原下拉箭头（appearance: none 会清掉浏览器原生箭头），并指定下拉项的暗色背景。
   注意 <option> 在不同浏览器（尤其是 Windows Chrome）只能继承部分样式，但至少能避免
   弹窗主体白底刺眼的问题。 */
select.form-input {
    padding-right: 32px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
                      linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 16px) center, calc(100% - 11px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

select.form-input option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* 表单字段下方的红字提示（用于强调可用性 / 风险类信息）。 */
.form-hint--danger {
    color: var(--accent-danger);
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.5;
}

.btn-primary {
    width: auto;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-primary), #4193ef);
    color: white;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.4);
}

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

.message {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--border-radius);
    font-size: 14px;
    text-align: center;
    display: none;
}

.message.error {
    display: block;
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--accent-danger);
}

.message.success {
    display: block;
    background: rgba(63, 185, 80, 0.15);
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: var(--accent-success);
}

/* ===== Main Page Layout ===== */
#main-page {
    display: none;
}

#main-page.active {
    display: flex;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo-icon {
    font-size: 24px;
}

.sidebar-header .logo-text {
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 0 0 auto;
    padding: 16px 12px;
}

/* ===== Sidebar Recent Chats (ChatGPT-style) ===== */
.sidebar-recent-chats {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 12px 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-recent-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 4px 6px 8px;
    color: var(--text-muted, var(--text-secondary));
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-recent-title-text {
    font-weight: 600;
    opacity: 0.85;
}

.sidebar-recent-tab {
    flex: none;
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: var(--text-muted, var(--text-secondary));
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    cursor: pointer;
    opacity: 0.65;
    transition: var(--transition);
}

.sidebar-recent-tab:hover {
    opacity: 1;
    color: var(--text-primary);
}

.sidebar-recent-tab.active {
    opacity: 1;
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.12);
}

.sidebar-recent-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-recent-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.sidebar-recent-item {
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    user-select: none;
}

.sidebar-recent-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-recent-item.active {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.sidebar-recent-row1 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.sidebar-recent-chat-id {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.sidebar-recent-status {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-recent-status.running {
    color: var(--accent-warning);
}

.sidebar-recent-status.completed {
    color: var(--accent-success);
}

.sidebar-recent-status.terminated {
    color: var(--accent-danger);
}

.sidebar-recent-title {
    min-width: 0;
    font-size: 13px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-recent-star {
    margin-left: auto;
    font-size: 12px;
    color: var(--accent-warning, #d29922);
    opacity: 0.9;
    line-height: 1;
}

.sidebar-recent-empty {
    padding: 12px 10px;
    color: var(--text-secondary);
    font-size: 13px;
    opacity: 0.7;
    text-align: center;
}

.sidebar-recent-load-more {
    padding: 8px 4px 2px;
}

.sidebar-recent-load-more-btn {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    transition: var(--transition);
}

.sidebar-recent-load-more-btn:hover:not(:disabled) {
    color: var(--accent-primary);
    border-color: rgba(88, 166, 255, 0.4);
}

.sidebar-recent-load-more-btn:disabled {
    cursor: default;
    opacity: 0.65;
}

/* chats-view 主侧栏已承载 Recent 列表，隐藏视图内置的 sc-sidebar 让主区域全宽 */
.chats-split-view .sc-sidebar,
.chats-split-view .sc-sidebar-toggle,
.chats-split-view .sc-sidebar-overlay {
    display: none !important;
}

.chats-split-view .sc-main {
    margin-left: 0;
    width: 100%;
    flex: 1 1 auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user-panel {
    margin-bottom: 12px;
    padding: 10px 10px 10px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.sidebar-user-panel-clickable {
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-user-panel-clickable:hover {
    background: var(--bg-card);
    border-color: rgba(88, 166, 255, 0.35);
    box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.15);
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 4px 2px;
    background: transparent;
    border-radius: 0;
}

.user-avatar {
    font-size: 20px;
}

.btn-logout {
    width: 100%;
    padding: 10px 10px 10px 34px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-align: left;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(248, 81, 73, 0.15);
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    padding: 24px;
    background: var(--bg-primary);
    min-height: 100vh;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

/* List views fill the available main-content width. On wide monitors the
   per-column percentage widths defined further below redistribute the extra
   space proportionally instead of dumping it all into the title/name column. */
#clients-view {
    width: 100%;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.view-header .btn-primary {
    padding: 10px 20px;
}

.view-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tasks-toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.task-filter-group {
    flex-wrap: wrap;
}

.filter-label {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
}

.status-filter-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-btn.checked {
    background: rgba(88, 166, 255, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.filter-btn input[type="checkbox"] {
    display: none;
}

/* Search Input */
.search-input {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    width: 140px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Load More Indicator */
.load-more-indicator {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Filter checkbox style */
.filter-btn input[type="checkbox"] {
    margin-right: 6px;
    accent-color: var(--accent-primary);
}

/* ===== Data Table ===== */
.table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow-x: auto;
    overflow-y: hidden;
}

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

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

.data-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(88, 166, 255, 0.05);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.tasks-table {
    table-layout: fixed;
}

/* Title column is the only "auto" column — it absorbs remaining width and
   ellipsis-truncates long titles. All other columns are fixed-width so the
   table degrades gracefully on laptop widths without wrapping action buttons. */
.tasks-table .task-col-id {
    width: 72px;
}

.tasks-table .task-col-title {
    width: auto;
}

.tasks-table .task-col-status {
    width: 130px;
}

.tasks-table .task-col-client {
    width: 150px;
}

.tasks-table .task-col-created {
    width: 168px;
}

.tasks-table .task-col-actions {
    width: 220px;
}

.task-title-cell {
    max-width: 0;
}

.task-title-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.task-actions-cell {
    white-space: normal;
}

.task-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
}

.task-actions .btn-action {
    margin-right: 0;
    padding: 5px 10px;
    flex: none;
    white-space: nowrap;
}

.clients-table {
    min-width: 960px;
    table-layout: fixed;
}

.clients-table .client-col-id {
    width: 78px;
}

.clients-table .client-col-name {
    width: auto;
}

.clients-table .client-col-status {
    width: 130px;
}

.clients-table .client-col-links {
    width: 140px;
}

.clients-table .client-col-created {
    width: 170px;
}

.clients-table .client-col-actions {
    width: 200px;
}

.clients-card-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 18px;
}

.clients-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.published-app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.published-app-grid-compact {
    width: min(960px, 100%);
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.clients-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
}

.clients-tab-btn {
    padding: 8px 18px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.clients-tab-btn:hover,
.clients-tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.client-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.06), rgba(13, 17, 23, 0));
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.client-card-clickable {
    cursor: pointer;
}

.client-card:hover {
    border-color: rgba(88, 166, 255, 0.35);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.app-card-preview {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
}

button.app-card-preview {
    padding: 0;
    text-align: left;
}

.app-card-preview iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    border: 0;
    pointer-events: none;
    transform: scale(0.5);
    transform-origin: top left;
    background: #fff;
}

.app-card-thumbnail-shell,
.app-card-thumbnail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.app-card-thumbnail-shell {
    background:
        radial-gradient(circle at top left, rgba(88, 166, 255, 0.12), transparent 38%),
        var(--bg-secondary);
}

.app-card-thumbnail {
    display: block;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.app-card-thumbnail-shell.is-thumbnail-loaded .app-card-thumbnail {
    opacity: 1;
}

.app-card-thumbnail-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
    background: rgba(13, 17, 23, 0.58);
    transition: opacity 0.2s ease;
}

.app-card-thumbnail-shell.is-thumbnail-loaded .app-card-thumbnail-state {
    opacity: 0;
}

.app-card-thumbnail-shell.is-thumbnail-failed .app-card-thumbnail-state {
    opacity: 1;
}

.app-card-thumbnail-shell.is-thumbnail-failed .app-card-placeholder-sub {
    color: var(--accent-warning);
}

.app-card-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
}

.app-card-preview-default-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
    background:
        radial-gradient(circle at top left, rgba(88, 166, 255, 0.12), transparent 38%),
        var(--bg-secondary);
}

.app-card-placeholder-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-primary);
}

.app-card-preview-placeholder.is-unavailable .app-card-placeholder-icon {
    background: rgba(210, 153, 34, 0.14);
    color: var(--accent-warning);
}

.app-card-placeholder-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.app-card-placeholder-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.client-card-title {
    min-width: 0;
}

.client-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.client-card-id {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 600;
}

.client-card-name {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-card-field {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.client-card-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.client-card-value {
    min-width: 0;
    color: var(--text-primary);
    font-size: 14px;
}

.client-card-field-link .client-card-value {
    display: flex;
    min-width: 0;
}

.client-prod-link-empty {
    color: var(--text-secondary);
    font-size: 13px;
}

.client-card-actions {
    margin-top: auto;
    padding-top: 2px;
}

.app-card-social {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.app-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    font-size: 12px;
    transition: var(--transition);
}

.app-social-btn strong {
    color: var(--text-primary);
    font-weight: 700;
}

.app-social-btn:hover,
.app-social-btn.active {
    border-color: rgba(88, 166, 255, 0.45);
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.12);
}

.app-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.app-pagination:empty {
    display: none;
}

.app-pagination-summary,
.app-page-info {
    color: var(--text-secondary);
    font-size: 13px;
}

.app-pagination-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-pagination .btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sc-published-apps {
    width: min(960px, 100%);
    margin-top: 28px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.sc-published-apps-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.sc-published-apps-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.sc-published-apps-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.client-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.client-status-badge.status-creating {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

.client-status-badge.status-success {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.client-status-badge.status-failed {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger, #f85149);
}

.client-status-badge.status-starting {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary, #58a6ff);
}

.client-status-badge.status-updating {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.client-status-badge.clickable {
    cursor: pointer;
    border: 1px solid transparent;
    transition: filter 150ms ease, border-color 150ms ease;
}

.client-status-badge.clickable:hover {
    filter: brightness(1.1);
    border-color: currentColor;
}

.client-status-badge.clickable:focus-visible {
    outline: none;
    border-color: currentColor;
}

.client-status-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.client-status-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.client-status-detail-trace {
    font-size: 12px;
    color: var(--text-secondary, #8b949e);
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    padding: 4px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    cursor: pointer;
    user-select: all;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-status-detail-trace:hover {
    color: var(--text-primary);
    border-color: var(--accent-color, #58a6ff);
}

.client-status-detail-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.04));
    padding: 12px 16px;
    border-radius: 8px;
    max-height: 60vh;
    overflow-y: auto;
}

.client-status-detail-empty {
    font-size: 14px;
    color: var(--text-secondary, #8b949e);
    padding: 24px 0;
    text-align: center;
}

.client-create-events-wrap {
    max-height: 60vh;
    overflow: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.client-create-events-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.client-create-events-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, #8b949e);
    font-weight: 600;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    white-space: nowrap;
}

.client-create-events-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
    vertical-align: top;
    color: var(--text-primary);
    line-height: 1.5;
}

.client-create-events-table tbody tr:last-child td {
    border-bottom: none;
}

.client-create-events-table .event-detail {
    white-space: pre-wrap;
    word-break: break-word;
}

.client-create-events-table .event-detail-error {
    color: var(--accent-danger, #f85149);
}

.client-links {
    display: flex;
    gap: 6px;
}

.client-links .btn-action {
    margin-right: 0;
}

.client-card-field-link .btn-link-prod {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.btn-link-test {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.btn-link-test:hover {
    background: rgba(88, 166, 255, 0.25);
}

.btn-link-prod {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.btn-link-prod:hover {
    background: rgba(63, 185, 80, 0.25);
}

.client-name-cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.client-name-text,
.client-creator {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deployment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.deployment-badge.cloud {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.deployment-badge.local {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
}

.client-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.client-card-actions .client-actions {
    justify-content: flex-start;
}

.client-actions .btn-action {
    margin-right: 0;
}

@media (max-width: 768px) {
    .clients-card-container {
        padding: 12px;
    }

    .clients-card-grid {
        grid-template-columns: 1fr;
    }

    .client-card {
        padding: 16px;
    }

    .client-card-field {
        grid-template-columns: 1fr;
        gap: 6px;
        align-items: flex-start;
    }
}

.page-size-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.task-page-size {
    min-width: 76px;
    padding: 6px 28px 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
}

.task-page-size:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}

.task-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.task-pagination-summary,
.task-page-info {
    color: var(--text-secondary);
    font-size: 13px;
}

.task-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-pagination .btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: rgba(245, 158, 11, 0.18);
    color: #d97706;
}

.status-running {
    background: rgba(79, 70, 229, 0.25);
    color: #6366f1;
    font-weight: 500;
}

.status-suspended {
    background-color: #f39c12;
    color: white;
}

.status-completed {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

/* Action Buttons */
.btn-action {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    transition: var(--transition);
    margin-right: 8px;
}

.btn-edit {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.btn-edit:hover {
    background: rgba(88, 166, 255, 0.25);
}

.btn-delete {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

.btn-delete:hover {
    background: rgba(248, 81, 73, 0.25);
}

.btn-reset {
    background: rgba(255, 180, 50, 0.15);
    color: #ffb432;
}

.btn-reset:hover {
    background: rgba(255, 180, 50, 0.25);
}

.btn-info {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
}

.btn-info:hover {
    background: rgba(163, 113, 247, 0.25);
}

.btn-chat {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.btn-chat:hover {
    background: rgba(63, 185, 80, 0.25);
}

.btn-preview {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.btn-preview:hover {
    background: rgba(88, 166, 255, 0.25);
}

.btn-deploy {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
}

.btn-deploy:hover {
    background: rgba(163, 113, 247, 0.25);
}

.btn-cancel {
    background: rgba(255, 180, 50, 0.15);
    color: #ffb432;
}

.btn-cancel:hover {
    background: rgba(255, 180, 50, 0.25);
}

.btn-retry {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.btn-retry:hover {
    background: rgba(59, 130, 246, 0.25);
}

/* Deploy Records Table */
.deploy-records-container {
    max-height: 500px;
    overflow-y: auto;
}

.deploy-records-table {
    width: 100%;
}

.deploy-records-table th,
.deploy-records-table td {
    padding: 10px 12px;
    font-size: 13px;
}

.deploy-desc-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deploy-detail-cell {
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    color: var(--text-muted);
}

.env-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.env-badge.env-test {
    background: rgba(43, 147, 213, 0.12);
    color: var(--accent-primary);
}

.env-badge.env-prod {
    background: rgba(163, 113, 247, 0.12);
    color: var(--accent-purple);
}

.deploy-status-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.deploy-status-chip.status-pending {
    background: rgba(210, 153, 34, 0.12);
    color: var(--accent-warning);
}

.deploy-status-chip.status-publishing {
    background: rgba(43, 147, 213, 0.12);
    color: var(--accent-primary);
}

.deploy-status-chip.status-failed {
    background: rgba(248, 81, 73, 0.12);
    color: var(--accent-danger);
}

.deploy-status-chip.status-success {
    background: rgba(63, 185, 80, 0.12);
    color: var(--accent-success);
}

.deploy-status-chip.status-cancel {
    background: rgba(139, 148, 158, 0.12);
    color: var(--text-muted);
}

/* Task Detail Modal Styles */
.task-detail-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.task-detail-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-detail-section h4 {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.task-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.task-link-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 6px;
    color: var(--accent-primary);
    font-size: 13px;
    transition: var(--transition);
}

.task-link-item:hover {
    background: rgba(88, 166, 255, 0.2);
    border-color: var(--accent-primary);
}

.task-desc-text {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.links-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.links-editor .types-table {
    margin-bottom: 0;
}

.links-editor .types-table input {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
}

.links-editor .types-table input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
}

/* 只读字段样式 */
.readonly-field {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* 表单行 - 并排布局 */
.form-row {
    display: flex;
    gap: 16px;
}

.form-group-half {
    flex: 2;
    min-width: 0;
}

.form-group-quarter {
    flex: 1;
    min-width: 0;
}

/* 自适应宽弹窗：用于内容较丰富的弹窗（如"添加应用"、"创建详情"），
   小屏笔记本（~1280px）下达到 ~830px，桌面大屏（≥1440px）下到 936px，
   超过 1500px 视口时被 960px 上限封顶，避免过宽影响阅读 */
.modal.modal-wide {
    max-width: clamp(560px, 65vw, 960px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal.modal-wide .modal-content {
    flex: 1;
    overflow-y: auto;
}

.modal.modal-support-detail {
    max-width: clamp(520px, 72vw, 880px);
    min-height: min(560px, calc(100vh - 40px));
    max-height: min(82vh, 760px);
    display: flex;
    flex-direction: column;
}

.modal.modal-support-detail .modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Task Edit Modal - larger size */
.modal.modal-task-edit,
.modal.modal-task-detail {
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal.modal-task-edit .modal-content,
.modal.modal-task-detail .modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal.modal-task-edit .task-edit-content,
.modal.modal-task-detail .task-detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* 滚动区域 */
.task-edit-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -8px;
    min-height: 0;
}

/* 描述框所在的 form-group 不设置 flex */
.task-edit-scroll .form-group {
    flex-shrink: 0;
}

/* 自定义滚动条样式 */
.task-edit-scroll::-webkit-scrollbar {
    width: 6px;
}

.task-edit-scroll::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.task-edit-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.task-edit-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 任务描述 - 自适应高度 */
.modal.modal-task-edit #task-edit-desc,
.modal.modal-task-detail #task-detail-desc {
    min-height: 120px;
    height: 150px;
    max-height: 800px;
    resize: vertical;
}

/* 任务描述文本 - 查看模式 */
.task-desc-text {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.modal.modal-task-edit .modal-actions,
.modal.modal-task-detail .modal-actions {
    flex-shrink: 0;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.modal.modal-task-edit .modal-actions .btn-primary,
.modal.modal-task-edit .modal-actions .btn-secondary,
.modal.modal-task-detail .modal-actions .btn-primary,
.modal.modal-task-detail .modal-actions .btn-secondary {
    min-width: 80px;
    padding: 8px 24px;
}

/* Empty State */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state.show {
    display: flex;
}

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

/* 应用页空状态：引导式提示 + 教程入口 */
.clients-empty-guide {
    text-align: center;
    max-width: 520px;
    margin: 0 auto;
    gap: 8px;
}

.clients-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.clients-empty-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.clients-empty-hint {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

.clients-empty-link {
    margin-top: 12px;
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--accent-primary);
    text-decoration: none;
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    transition: background-color 150ms ease, color 150ms ease;
}

.clients-empty-link:hover {
    background-color: var(--accent-primary);
    color: #fff;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 20px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-content {
    padding: 24px;
}

.modal-content .form-group {
    margin-bottom: 16px;
}

.modal-content select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-content select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.modal-content > form > .btn-primary {
    width: 100%;
    margin-top: 8px;
}

.modal.modal-new-user-gift {
    max-width: 520px;
    overflow: hidden;
}

.new-user-gift-celebration {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 4px 4px;
    overflow: hidden;
}

.new-user-fireworks {
    position: absolute;
    inset: -24px 0 auto 0;
    height: 180px;
    pointer-events: none;
}

.new-user-fireworks span {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow:
        0 -28px 0 #f0b429,
        20px -20px 0 #ff7b72,
        28px 0 0 var(--accent-success),
        20px 20px 0 var(--accent-purple),
        0 28px 0 #58a6ff,
        -20px 20px 0 #f0b429,
        -28px 0 0 #ff7b72,
        -20px -20px 0 var(--accent-success);
    animation: newUserFirework 1.4s ease-out infinite;
    opacity: 0;
}

.new-user-fireworks span:nth-child(1) { top: 56px; left: 18%; animation-delay: 0s; }
.new-user-fireworks span:nth-child(2) { top: 42px; left: 74%; animation-delay: 0.18s; transform: scale(0.8); }
.new-user-fireworks span:nth-child(3) { top: 96px; left: 54%; animation-delay: 0.34s; transform: scale(0.7); }
.new-user-fireworks span:nth-child(4) { top: 118px; left: 28%; animation-delay: 0.52s; transform: scale(0.65); }
.new-user-fireworks span:nth-child(5) { top: 74px; left: 88%; animation-delay: 0.7s; transform: scale(0.55); }
.new-user-fireworks span:nth-child(6) { top: 126px; left: 80%; animation-delay: 0.88s; transform: scale(0.6); }

@keyframes newUserFirework {
    0% { opacity: 0; transform: scale(0.2); }
    18% { opacity: 1; }
    65% { opacity: 0.9; }
    100% { opacity: 0; transform: scale(1.25); }
}

.new-user-gift-icon {
    position: relative;
    z-index: 1;
    width: 86px;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto 16px;
    border-radius: 24px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.20), transparent 36%),
        linear-gradient(135deg, rgba(88, 166, 255, 0.24), rgba(163, 113, 247, 0.28));
    border: 1px solid rgba(88, 166, 255, 0.35);
    box-shadow: 0 16px 40px rgba(88, 166, 255, 0.18);
}

.new-user-gift-icon-img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 16px;
}

.new-user-gift-icon-fallback {
    font-size: 42px;
    line-height: 1;
}

.new-user-gift-celebration h4 {
    position: relative;
    z-index: 1;
    margin: 0 0 10px;
    font-size: 22px;
    color: var(--text-primary);
}

.new-user-gift-message,
.new-user-gift-next {
    position: relative;
    z-index: 1;
    max-width: 390px;
    margin: 0 auto;
    color: var(--text-secondary);
    line-height: 1.65;
}

.new-user-gift-message {
    font-size: 15px;
}

.new-user-gift-next {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.new-user-gift-celebration .btn-primary {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-top: 22px;
}

/* Status Select */
.status-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.status-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Status Select with status colors */
.status-select.status-running {
    background: rgba(79, 70, 229, 0.25);
    color: #6366f1;
    border-color: rgba(79, 70, 229, 0.4);
    font-weight: 500;
}

.status-select.status-pending {
    background: rgba(245, 158, 11, 0.18);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.3);
}

.status-select.status-suspended {
    background-color: #f39c12;
    color: white;
    border-color: rgba(243, 156, 18, 0.5);
}

.status-select.status-completed {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
    border-color: rgba(107, 114, 128, 0.25);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
    min-width: 280px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

.toast.success::before {
    content: '✓';
    color: var(--accent-success);
    font-weight: bold;
}

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

.toast.error::before {
    content: '✕';
    color: var(--accent-danger);
    font-weight: bold;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .auth-card {
        padding: 24px;
    }

    .view-header {
        align-items: flex-start;
    }

    .view-header-right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .config-tabs-nav {
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .config-section {
        padding: 18px;
    }

    .config-section-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .config-add-btn {
        align-self: flex-start;
    }

    .client-basic-grid {
        grid-template-columns: 1fr;
    }

    .env-var-row {
        flex-direction: column;
        align-items: stretch;
    }

    .env-var-key-input,
    .env-var-val-input {
        width: 100%;
        min-width: 0;
    }

    .env-var-eq {
        display: none;
    }

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

    .repo-card-header,
    .repo-field-row {
        flex-direction: column;
        align-items: stretch;
    }

    .repo-field-row .repo-field.repo-field-short,
    .repo-field-row.repo-field-row-3 .repo-field.repo-field-url {
        flex: 1 1 auto;
        min-width: 0;
    }

    .clients-table {
        min-width: 0;
    }

    .clients-table thead {
        display: none;
    }

    .clients-table,
    .clients-table tbody,
    .clients-table tr,
    .clients-table td {
        display: block;
        width: 100%;
    }

    .clients-table tbody {
        padding: 14px;
    }

    .clients-table tbody tr {
        margin-bottom: 14px;
        padding: 16px;
        border: 1px solid var(--border-color);
        border-radius: 14px;
        background: linear-gradient(180deg, rgba(88, 166, 255, 0.04), rgba(13, 17, 23, 0));
        box-shadow: var(--shadow-sm);
    }

    .clients-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .clients-table tbody tr:hover {
        background: linear-gradient(180deg, rgba(88, 166, 255, 0.08), rgba(13, 17, 23, 0));
    }

    .clients-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
    }

    .clients-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .clients-table td::before {
        content: attr(data-label);
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        text-align: left;
    }

    .clients-table td[data-label="名称"],
    .clients-table td[data-label="操作"] {
        align-items: flex-start;
        text-align: left;
    }

    .clients-table td[data-label="名称"] {
        flex-direction: column;
        gap: 8px;
    }

    .clients-table td[data-label="名称"]::before {
        width: 100%;
    }

    .clients-table td[data-label="操作"] {
        flex-direction: column;
        gap: 12px;
    }

    .clients-table td[data-label="操作"]::before {
        width: 100%;
    }

    .clients-table .client-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .clients-table .client-actions .btn-action {
        flex: none;
        text-align: center;
    }

    .task-table-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .sidebar {
        width: min(260px, 80vw);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.45);
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        padding: 16px 12px;
        padding-top: 56px;
    }

    .task-pagination {
        width: 100%;
        justify-content: space-between;
    }
}

/* ===== Task Key Style ===== */
.task-key {
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    letter-spacing: 1px;
}

/* ===== Type Tag ===== */
.type-tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== Time Display ===== */
.time-display {
    color: var(--text-secondary);
    font-size: 13px;
}

.time-display.online {
    color: var(--accent-success);
}

.time-display.offline {
    color: var(--text-muted);
}

/* ===== Types Editor ===== */
.types-editor {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.types-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.types-input-row input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
}

.types-input-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

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

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

.types-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
}

.types-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.types-table tbody tr:last-child td {
    border-bottom: none;
}

.types-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small.btn-add {
    background: var(--accent-primary);
    color: white;
}

.btn-small.btn-add:hover {
    background: #4a90e0;
}

.btn-small.btn-delete {
    background: transparent;
    color: var(--accent-danger);
    border: 1px solid var(--accent-danger);
    white-space: nowrap;
}

.btn-small.btn-delete:hover {
    background: var(--accent-danger);
    color: white;
}

/* ===== Flow Chart ===== */
.flow-chart-container {
    width: 100%;
    height: calc(100vh - 180px);
    min-height: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: auto;
    position: relative;
}

.flow-chart-canvas {
    position: relative;
    min-width: 100%;
    min-height: 100%;
    padding: 20px;
    padding-bottom: 100px;
}

.flow-chart-edges {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.flow-edge {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 2;
    stroke-linecap: round;
}

.flow-chart-nodes {
    position: relative;
    z-index: 2;
}

/* Flow Node */
.flow-node {
    position: absolute;
    width: 280px;
    min-height: 120px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}

.flow-node:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.flow-node-selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

/* Node Status Colors */
.flow-node-pending {
    border-left: 4px solid var(--accent-warning);
}

.flow-node-in_progress {
    border-left: 4px solid var(--accent-primary);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(88, 166, 255, 0.05) 100%);
}

.flow-node-completed {
    border-left: 4px solid var(--accent-success);
    opacity: 0.85;
}

.flow-node-skipped {
    border-left: 4px solid var(--text-muted);
    opacity: 0.6;
}

.flow-node-failed {
    border-left: 4px solid var(--accent-danger);
}

/* Node Header */
.flow-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.flow-node-status-icon {
    font-size: 16px;
}

.flow-node-title {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.flow-node-status-text {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.flow-node-in_progress .flow-node-status-text {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.flow-node-completed .flow-node-status-text {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

/* Node Body */
.flow-node-body {
    padding: 12px 16px;
}

.flow-node-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 8px 0;
}

/* Node Actions */
.flow-node-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.flow-btn-complete {
    width: 100%;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--accent-success), #2ea043);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.flow-btn-complete:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(63, 185, 80, 0.4);
}

/* Flow Toolbar */
.flow-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.flow-toolbar .btn-secondary {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.flow-toolbar .btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.flow-toolbar .btn-secondary.btn-success {
    background: rgba(63, 185, 80, 0.15);
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.flow-toolbar .btn-secondary.btn-success:hover {
    background: var(--accent-success);
    color: white;
}

/* Flow Info Panel */
.flow-info-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.flow-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flow-progress-bar {
    width: 200px;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.flow-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-success));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.flow-progress-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Modal size for flow detail */
/* Flow detail modal - extra large */
.modal.modal-flow {
    max-width: 1200px;
    height: 80vh;
}

.modal.modal-flow .modal-content {
    padding: 0;
    height: calc(80vh - 60px);
    overflow: hidden;
}

/* Required field indicator */
.required {
    color: var(--accent-danger);
}

/* Text muted style */
.text-muted {
    color: var(--text-muted);
}

/* Textarea styling */
textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

/* ===== Node Detail Panel ===== */
.node-panel {
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.node-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-bottom: 1px solid var(--border-color);
}

.node-panel-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.node-panel-info {
    flex: 1;
    min-width: 0;
}

.node-panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-panel-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Consolas', monospace;
}

.node-panel-section {
    padding: 12px 16px;
}

.node-panel-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.node-panel-label.section-title {
    font-size: 13px;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.node-panel-value {
    font-size: 14px;
    color: var(--text-primary);
}

.node-panel-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.node-panel-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.node-panel-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.node-panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.node-panel-empty .empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.node-panel-empty p {
    font-size: 14px;
}

.node-panel-empty-fields {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Node field styles */
.node-field {
    margin-bottom: 16px;
}

.node-field:last-child {
    margin-bottom: 0;
}

.node-field-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.node-field-required .node-field-label::after {
    content: ' *';
    color: var(--accent-danger);
}

.node-field-value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
    padding: 8px 0;
}

.node-field-input,
.node-field-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.node-field-input:focus,
.node-field-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.node-field-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    transition: var(--transition);
}

.node-field-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

/* Node Table Field Styles */
.node-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.node-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.node-table-thead {
    background: var(--bg-secondary);
}

.node-table-th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.node-table-tbody .node-table-tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.node-table-tbody .node-table-tr:hover {
    background: rgba(88, 166, 255, 0.05);
}

.node-table-td {
    padding: 8px 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.node-table-tbody .node-table-tr:last-child .node-table-td {
    border-bottom: none;
}

/* Table input for editable mode */
.node-table-input {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.node-table-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.node-table-input:hover {
    border-color: var(--text-muted);
}

/* Status badge in panel */
.node-panel .status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.status-pending {
    background: rgba(245, 158, 11, 0.18);
    color: #d97706;
}

.status-badge.status-running,
.status-badge.status-in_progress {
    background: rgba(79, 70, 229, 0.25);
    color: #6366f1;
    font-weight: 500;
}

.status-badge.status-reviewing {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
}

.status-badge.status-reviewed,
.status-badge.status-done,
.status-badge.status-completed {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.status-badge.status-error {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

.status-badge.status-revising {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

/* Updated flow node styles for compact display */
.flow-node {
    position: absolute;
    width: 220px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.flow-node:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.flow-node-selected {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25) !important;
}

.flow-node-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.flow-node-status-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.flow-node-label {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-node-status-badge {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* Node status colors */
.flow-node-pending {
    border-left: 4px solid var(--accent-warning);
}

.flow-node-pending .flow-node-status-badge {
    background: rgba(210, 153, 34, 0.1);
    color: var(--accent-warning);
}

.flow-node-running,
.flow-node-in_progress {
    border-left: 4px solid var(--accent-primary);
}

.flow-node-running .flow-node-status-badge,
.flow-node-in_progress .flow-node-status-badge {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
}

.flow-node-reviewing {
    border-left: 4px solid var(--accent-purple);
}

.flow-node-reviewing .flow-node-status-badge {
    background: rgba(163, 113, 247, 0.1);
    color: var(--accent-purple);
}

.flow-node-revising {
    border-left: 4px solid var(--accent-warning);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(210, 153, 34, 0.05) 100%);
}

.flow-node-revising .flow-node-status-badge {
    background: rgba(210, 153, 34, 0.1);
    color: var(--accent-warning);
}

.flow-node-reviewed,
.flow-node-done,
.flow-node-completed {
    border-left: 4px solid var(--accent-success);
}

.flow-node-reviewed .flow-node-status-badge,
.flow-node-done .flow-node-status-badge,
.flow-node-completed .flow-node-status-badge {
    background: rgba(63, 185, 80, 0.1);
    color: var(--accent-success);
}

.flow-node-failed {
    border-left: 4px solid var(--accent-danger);
}

.flow-node-failed .flow-node-status-badge {
    background: rgba(248, 81, 73, 0.1);
    color: var(--accent-danger);
}

.flow-node-error {
    border-left: 4px solid var(--accent-danger);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(248, 81, 73, 0.05) 100%);
}

.flow-node-error .flow-node-status-badge {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

/* ===== HTML/富文本字段样式 ===== */
.node-field-html {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    word-break: break-word;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.node-field-html a {
    color: var(--accent-primary);
    text-decoration: underline;
    transition: var(--transition);
}

.node-field-html a:hover {
    color: var(--accent-purple);
    text-decoration: none;
}

.node-field-html p {
    margin: 0 0 8px 0;
}

.node-field-html p:last-child {
    margin-bottom: 0;
}

.node-field-html ul,
.node-field-html ol {
    margin: 8px 0;
    padding-left: 20px;
}

.node-field-html li {
    margin-bottom: 4px;
}

.node-field-html code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.node-field-html pre {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    margin: 8px 0;
}

.node-field-html strong,
.node-field-html b {
    font-weight: 600;
    color: var(--text-primary);
}

.node-field-html em,
.node-field-html i {
    font-style: italic;
}

/* ===== 超链接字段样式 ===== */
.node-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(88, 166, 255, 0.15);
    border: 1px solid var(--accent-primary);
    border-radius: 6px;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.node-link-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}


/* ===== OKR Styles - Waterfall Version ===== */

/* 周期导航 */
.okr-cycle-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.cycle-type-btns {
    display: flex;
    gap: 8px;
}

.cycle-type-btn {
    padding: 8px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.cycle-type-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.cycle-type-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.cycle-period-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cycle-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.cycle-nav-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

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

.cycle-period-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 180px;
    text-align: center;
}

.cycle-period-select {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-width: 200px;
    cursor: pointer;
    transition: var(--transition);
}

.cycle-period-select:hover {
    border-color: var(--accent-primary);
}

.cycle-period-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.okr-download-md-btn {
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.okr-download-md-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* 瀑布流容器 */
.okr-waterfall-container {
    max-width: 900px;
}

.okr-waterfall {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 目标块 */
.okr-objective-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
}

/* O行 */
.okr-o-row {
    display: flex;
    align-items: stretch;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.okr-reorder-side {
    width: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-color);
    gap: 2px;
}

.okr-reorder-btn {
    width: 22px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
}

.okr-o-row:hover .okr-reorder-btn,
.okr-kr-row:hover .okr-reorder-btn {
    opacity: 1;
}

.okr-reorder-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.okr-reorder-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.okr-add-side {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-color);
}

.okr-side-add-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
}

.okr-o-row:hover .okr-side-add-btn,
.okr-kr-row:hover .okr-side-add-btn {
    opacity: 1;
}

.okr-side-add-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.okr-o-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.okr-o-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    min-width: 30px;
}

.okr-inline-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: var(--transition);
}

.okr-inline-input:hover {
    background: var(--bg-secondary);
}

.okr-inline-input:focus {
    outline: none;
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.okr-o-title {
    font-weight: 600;
    font-size: 16px;
}

.okr-delete-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
}

.okr-o-row:hover .okr-delete-btn,
.okr-kr-row:hover .okr-delete-btn {
    opacity: 1;
}

.okr-delete-btn:hover {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
}

/* KR行 */
.okr-kr-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border-color);
}

.okr-kr-row:last-child {
    border-bottom: none;
}

.okr-kr-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    padding-left: 24px;
}

.okr-kr-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-purple);
    min-width: 36px;
}

.okr-kr-title {
    font-size: 14px;
}

/* 添加按钮行 */
.okr-add-row {
    padding: 8px 16px;
    padding-left: 56px;
}

.okr-add-kr-row {
    background: var(--bg-card);
}

.okr-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.okr-add-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.05);
}

.okr-add-btn .add-icon {
    font-size: 16px;
    font-weight: 600;
}

.okr-add-objective {
    margin-top: 8px;
}

/* 保存指示器 */
.okr-save-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 20px;
    background: var(--accent-success);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.okr-save-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

/* 保留旧的卡片样式（供兼容） */
.okr-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.okr-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    transition: var(--transition);
}

.okr-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 20px rgba(88, 166, 255, 0.1);
}

.okr-card-header {
    margin-bottom: 16px;
}

.okr-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.okr-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.okr-status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.okr-status-badge.status-draft {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

.okr-status-badge.status-active {
    background: rgba(79, 70, 229, 0.25);
    color: #6366f1;
}

.okr-status-badge.status-completed {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.okr-status-badge.status-archived {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.okr-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.okr-progress-bar {
    position: relative;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: visible;
}

.okr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-purple));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.okr-progress-text {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.okr-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.okr-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.okr-kr-count {
    color: var(--text-secondary);
    font-size: 13px;
}

.okr-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

.btn-sm.btn-primary:hover {
    background: #4193ef;
}

.btn-sm.btn-danger {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
    border-color: transparent;
}

.btn-sm.btn-danger:hover {
    background: rgba(248, 81, 73, 0.25);
}

/* OKR Detail Modal */
.objective-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.obj-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.obj-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.obj-progress input[type="range"] {
    width: 150px;
}

.obj-meta {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.kr-section {
    margin-top: 16px;
}

.kr-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kr-section-header h4 {
    color: var(--text-primary);
    font-size: 16px;
    margin: 0;
}

.kr-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kr-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 14px;
}

.kr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.kr-title {
    font-weight: 500;
    color: var(--text-primary);
}

.kr-actions {
    display: flex;
    gap: 6px;
}

.kr-progress-bar {
    position: relative;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    margin-bottom: 8px;
}

.kr-progress-fill {
    height: 100%;
    background: var(--accent-success);
    border-radius: 3px;
}

.kr-progress-text {
    position: absolute;
    right: 0;
    top: -18px;
    font-size: 11px;
    color: var(--text-secondary);
}

.kr-value {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.kr-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.kr-tasks {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.kr-tasks-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 8px;
}

.task-tag {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(88, 166, 255, 0.1);
    border-radius: 4px;
    font-size: 11px;
    color: var(--accent-primary);
    margin-right: 6px;
}

.empty-text {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Form Select */
.form-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

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

/* ===== TodoList Styles ===== */
.todo-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.todo-add-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.todo-add-row input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.todo-add-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.btn-add-todo {
    padding: 12px 24px;
    flex-shrink: 0;
}

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.todo-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card);
}

.todo-item.completed {
    opacity: 0.6;
}

.todo-item.completed .todo-content {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-success);
    cursor: pointer;
    flex-shrink: 0;
}

.todo-content {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
    cursor: text;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.todo-content:hover {
    background: var(--bg-secondary);
}

.todo-content-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.todo-delete {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--accent-danger);
    border-radius: 4px;
    color: var(--accent-danger);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    opacity: 0;
}

.todo-item:hover .todo-delete {
    opacity: 1;
}

.todo-delete:hover {
    background: var(--accent-danger);
    color: white;
}

/* Todo filter buttons */
.todo-filter-btns {
    display: flex;
    gap: 8px;
}

.todo-filter-btns .filter-btn input[type="radio"] {
    display: none;
}

/* ===== 仓库配置瀑布流样式 ===== */
.repos-waterfall {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.repos-empty-tip {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
}

.repo-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.repo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.repo-card-index {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-primary);
}

.repo-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.repo-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.repo-field label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.repo-field input,
.repo-field textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.repo-field input:focus,
.repo-field textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.repo-field textarea {
    resize: vertical;
    min-height: 60px;
}

.repo-field-row {
    display: flex;
    gap: 12px;
}

.repo-field-row .repo-field {
    flex: 1;
}

.repo-field-row .repo-field.repo-field-short {
    flex: 0 0 140px;
}

.repo-field-row.repo-field-row-3 .repo-field.repo-field-url {
    flex: 1;
    min-width: 200px;
}

/* 文档仓库标记样式 */
.repo-card-docs {
    border-color: var(--accent-success);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(63, 185, 80, 0.05) 100%);
}

.repo-card-docs .repo-card-header {
    background: rgba(63, 185, 80, 0.1);
}

.repo-docs-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-left: auto;
    margin-right: 12px;
}

.repo-docs-toggle input[type="radio"] {
    accent-color: var(--accent-success);
    cursor: pointer;
}

.repo-docs-label {
    color: var(--text-secondary);
    transition: var(--transition);
}

.repo-docs-toggle input[type="radio"]:checked + .repo-docs-label {
    color: var(--accent-success);
    font-weight: 600;
}

/* ===== 执行状态错误样式 ===== */
.flow-status-error {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-danger);
}

.btn-error-detail {
    padding: 2px 8px;
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid var(--accent-danger);
    border-radius: 4px;
    color: var(--accent-danger);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-error-detail:hover {
    background: var(--accent-danger);
    color: white;
}

/* 错误详情弹窗样式 */
.error-detail-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.error-detail-icon {
    font-size: 48px;
}

.error-detail-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-danger);
}

.error-detail-message {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
}

.error-pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

/* ===== 执行详情弹窗样式 ===== */
.modal-flow .modal {
    max-width: 800px;
    max-height: 90vh;
}

.flow-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.flow-modal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-muted);
}

.flow-modal-empty .empty-icon {
    font-size: 48px;
}

.flow-modal-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 13px;
}

.flow-modal-label {
    color: var(--text-muted);
}

.flow-modal-node-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 500;
}

.node-status-icon {
    font-size: 20px;
}

.node-status-badge {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.node-status-badge.status-pending {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.node-status-badge.status-running,
.node-status-badge.status-in_progress {
    background: rgba(163, 113, 247, 0.15);
    color: #a371f7;
}

.node-status-badge.status-done,
.node-status-badge.status-completed,
.node-status-badge.status-reviewed {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
}

.node-status-badge.status-reviewing,
.node-status-badge.status-revising {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
}

.node-status-badge.status-error,
.node-status-badge.status-failed {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
}

.flow-modal-node-detail {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.flow-modal-node-detail .node-field {
    margin-bottom: 16px;
}

.flow-modal-node-detail .node-field:last-child {
    margin-bottom: 0;
}

.flow-modal-node-detail .node-field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.flow-modal-node-detail .node-field-html {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.flow-modal-node-detail .node-field-html a {
    color: var(--accent-primary);
    text-decoration: none;
}

.flow-modal-node-detail .node-field-html a:hover {
    text-decoration: underline;
}

.node-link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.node-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid var(--accent-primary);
    border-radius: 6px;
    color: var(--accent-primary);
    font-size: 13px;
    text-decoration: none;
    transition: var(--transition);
}

.node-link-btn:hover {
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
}

.node-panel-empty-fields {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== 客户端配置页面 ===== */

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

.btn-back {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-back:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Tab 导航 */
.config-tabs-nav {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 0 0 0;
    margin-bottom: 24px;
}

.config-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: -1px;
}
.config-tab-btn:hover:not(:disabled) {
    color: var(--text-primary);
}
.config-tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}
.config-tab-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Tab 内容面板 */
.config-tab-panels {
    flex: 1;
    overflow-y: auto;
}
.config-tab-panel {
    display: none;
}
.config-tab-panel.active {
    display: block;
}

/* Section */
.config-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}
.config-section-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.config-section-intro {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.config-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.config-section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}
.config-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.config-btn-group {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.config-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.config-section-tip {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
}
.tip-info {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(88, 166, 255, 0.3);
}
.tip-warn {
    background: rgba(210, 153, 34, 0.1);
    color: var(--accent-warning);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.client-basic-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

.client-basic-grid .form-group {
    margin-bottom: 0;
}

.client-basic-grid input,
.client-basic-grid select {
    width: 100%;
}

.client-basic-name {
    max-width: 560px;
}

.client-basic-icon {
    max-width: 560px;
}

.app-icon-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.app-icon-preview {
    margin-top: 10px;
}

.app-icon-preview img {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 3 / 2;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    object-fit: cover;
    background: var(--bg-secondary);
}

.app-icon-upload-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* 环境变量列表 */
.env-vars-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.env-var-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
}
.env-var-row-editing {
    border-color: var(--accent-primary);
}
.env-var-key {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 120px;
    word-break: break-all;
}
.env-var-eq {
    color: var(--text-muted);
    flex-shrink: 0;
}
.env-var-val {
    color: var(--text-secondary);
    flex: 1;
    word-break: break-all;
}
.env-var-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}
.env-var-key-input {
    font-family: 'Courier New', monospace;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13px;
    min-width: 140px;
    width: 240px;
}
.env-var-key-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}
.env-var-val-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13px;
    flex: 1;
}
.env-var-val-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}
.env-var-key-input:disabled,
.env-var-val-input:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}
.btn-save-sm {
    padding: 4px 10px;
    background: var(--accent-success);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: var(--transition);
}
.btn-save-sm:hover {
    opacity: 0.85;
}
.btn-cancel-sm {
    padding: 4px 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: var(--transition);
}
.btn-cancel-sm:hover {
    background: var(--bg-tertiary);
}

/* ===== Admin 商品 / 订单（嵌入 index.html，仅 /admin 使用） ===== */
#products-view .commerce-card,
#orders-view .commerce-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

#products-view .commerce-card-gap,
#orders-view .commerce-card-gap {
    margin-top: 16px;
}

#products-view .section-title,
#orders-view .section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

#products-view .commerce-row,
#orders-view .commerce-filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

#products-view .commerce-col,
#orders-view .commerce-col {
    flex: 1;
    min-width: 160px;
}

#products-view .commerce-label,
#orders-view .commerce-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

#products-view .commerce-form input,
#products-view .commerce-form select,
#orders-view .commerce-filter-row input,
#orders-view .commerce-filter-row select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
}

#products-view .commerce-form input::placeholder,
#orders-view .commerce-filter-row input::placeholder {
    color: var(--text-muted);
}

#products-view .commerce-form input:focus,
#products-view .commerce-form select:focus,
#orders-view .commerce-filter-row input:focus,
#orders-view .commerce-filter-row select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

#orders-view .commerce-filter-row select {
    cursor: pointer;
}

#orders-view .commerce-filter-row select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#products-view .commerce-checkbox-row {
    margin-top: 12px;
}

#products-view .commerce-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

#products-view .commerce-checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

#products-view .commerce-actions-row {
    margin-top: 16px;
}

#orders-view .commerce-filter-actions {
    display: flex;
    align-items: flex-end;
    padding-bottom: 1px;
}

#orders-view .commerce-filter-actions .btn-primary {
    padding: 8px 20px;
}

#products-view .commerce-table-wrap,
#orders-view .commerce-table-wrap {
    overflow-x: auto;
    margin-top: 4px;
}

#products-view .commerce-table,
#orders-view .commerce-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#products-view .commerce-table thead th,
#orders-view .commerce-table thead th {
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
}

#products-view .commerce-table tbody td,
#orders-view .commerce-table tbody td {
    padding: 10px 14px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

#products-view .commerce-table tbody tr,
#orders-view .commerce-table tbody tr {
    transition: var(--transition);
}

#products-view .commerce-table tbody tr:hover,
#orders-view .commerce-table tbody tr:hover {
    background: rgba(88, 166, 255, 0.04);
}

#products-view .commerce-table tbody tr:last-child td,
#orders-view .commerce-table tbody tr:last-child td {
    border-bottom: none;
}

#products-view .commerce-code,
#orders-view .commerce-code {
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

#products-view .commerce-amount,
#orders-view .commerce-amount {
    font-weight: 600;
    color: var(--accent-primary);
}

#products-view .commerce-empty-cell,
#orders-view .commerce-empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 10px !important;
    white-space: normal;
}

#products-view .commerce-muted,
#orders-view .commerce-muted {
    color: var(--text-muted);
    font-size: 12px;
}

#products-view .commerce-badge,
#orders-view .commerce-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

#products-view .commerce-product-online {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

#products-view .commerce-product-offline {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

#orders-view .commerce-order-pending {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

#orders-view .commerce-order-paid {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

#orders-view .commerce-order-failed {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

#orders-view .commerce-order-refunded {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(163, 113, 247, 0.3);
}

#orders-view .commerce-order-gift {
    background: rgba(56, 139, 253, 0.15);
    color: var(--accent-info, #388bfd);
    border: 1px solid rgba(56, 139, 253, 0.3);
}

#orders-view .commerce-order-unknown {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

#products-view .commerce-edit-btn {
    padding: 5px 12px;
    font-size: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

#products-view .commerce-edit-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

#products-view .commerce-offline-btn {
    padding: 5px 12px;
    font-size: 12px;
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

#products-view .commerce-offline-btn:hover {
    background: rgba(248, 81, 73, 0.25);
}

#products-view .commerce-online-btn {
    padding: 5px 12px;
    font-size: 12px;
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(63, 185, 80, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

#products-view .commerce-online-btn:hover {
    background: rgba(63, 185, 80, 0.25);
}

#orders-view .commerce-refund-btn {
    padding: 5px 12px;
    font-size: 12px;
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

#orders-view .commerce-refund-btn:hover {
    background: rgba(248, 81, 73, 0.25);
}

#orders-view .commerce-pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

#orders-view .commerce-page-info {
    color: var(--text-muted);
}

#orders-view .commerce-pagination .btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 订单管理：整体加大字号，减轻阅读负担 */
#orders-view .section-title {
    font-size: 20px;
    margin-bottom: 18px;
}

#orders-view .commerce-label {
    font-size: 15px;
    margin-bottom: 8px;
}

#orders-view .commerce-filter-row input,
#orders-view .commerce-filter-row select {
    padding: 10px 14px;
    font-size: 16px;
}

#orders-view .commerce-filter-actions .btn-primary {
    padding: 10px 22px;
    font-size: 15px;
}

#orders-view .commerce-table {
    font-size: 15px;
}

#orders-view .commerce-table thead th {
    padding: 12px 16px;
    font-size: 13px;
    letter-spacing: 0.02em;
}

#orders-view .commerce-table tbody td {
    padding: 12px 16px;
    font-size: 15px;
}

#orders-view .commerce-table tbody td:nth-child(6) {
    white-space: normal;
    max-width: 240px;
    word-break: break-all;
}

#orders-view .commerce-code {
    font-size: 14px;
    padding: 4px 8px;
}

#orders-view .commerce-muted {
    font-size: 14px;
}

#orders-view .commerce-badge {
    font-size: 13px;
    padding: 4px 12px;
}

#orders-view .commerce-offline-btn,
#orders-view .commerce-refund-btn {
    padding: 7px 14px;
    font-size: 14px;
}

#orders-view .commerce-pagination {
    font-size: 15px;
    margin-top: 18px;
}

#orders-view .commerce-page-info {
    font-size: 15px;
}

/* 商品管理页：顶栏 + 卡片列表 */
#products-view .commerce-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

#products-view .commerce-page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

#products-view .commerce-page-sub {
    margin: 6px 0 0 0;
    font-size: 15px;
    color: var(--text-secondary);
}

#products-view .commerce-add-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid rgba(88, 166, 255, 0.45);
    box-shadow: none;
    transition: var(--transition);
}

#products-view .commerce-add-product-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
}

#products-view .commerce-add-icon {
    font-size: 15px;
    line-height: 1;
    font-weight: 500;
    opacity: 0.9;
}

#orders-view .commerce-input-plain {
    -moz-appearance: textfield;
}

#orders-view .commerce-input-plain::-webkit-outer-spin-button,
#orders-view .commerce-input-plain::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#products-view .commerce-products-board {
    padding: 22px 24px;
}

#products-view .commerce-products-board-title {
    font-size: 18px;
    margin-bottom: 18px;
}

#products-view .commerce-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 20px;
}

#products-view .commerce-products-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

#products-view .commerce-product-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

#products-view .commerce-product-card:hover {
    border-color: rgba(88, 166, 255, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

#products-view .commerce-product-card.is-offline {
    opacity: 0.88;
}

#products-view .commerce-product-card-media {
    aspect-ratio: 3 / 2;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#products-view .commerce-product-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#products-view .commerce-product-card-media-placeholder {
    font-size: 40px;
    opacity: 0.35;
}

#products-view .commerce-product-card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

#products-view .commerce-product-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

#products-view .commerce-product-card-name {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

#products-view .commerce-product-card-key {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

#products-view .commerce-product-card-id {
    font-size: 12px;
    color: var(--text-muted);
}

#products-view .commerce-product-card-price {
    font-size: 22px;
    font-weight: 700;
}

#products-view .commerce-product-card-desc {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
}

#products-view .commerce-product-card-meta {
    list-style: none;
    margin: 0;
    padding: 12px 0 0 0;
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    font-size: 13px;
}

#products-view .commerce-product-card-meta li {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#products-view .commerce-product-card-meta span {
    color: var(--text-muted);
    font-size: 12px;
}

#products-view .commerce-product-card-meta strong {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

#products-view .commerce-product-card-meta li:last-child {
    grid-column: 1 / -1;
}

#products-view .commerce-meta-time {
    color: var(--text-muted);
    font-weight: 500;
}

#products-view .commerce-product-card-actions {
    margin-top: auto;
    padding-top: 4px;
    display: flex;
    gap: 8px;
}

#products-view .commerce-product-card .commerce-code {
    font-size: 12px;
}

#products-view .commerce-product-card .commerce-edit-btn,
#products-view .commerce-product-card .commerce-offline-btn,
#products-view .commerce-product-card .commerce-online-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 14px;
    font-size: 14px;
}

/* 新增商品弹窗 + 简易富文本 */
.modal.modal-commerce-product {
    /* 自适应宽度：笔记本 ≥640，常规屏 ~80vw，超大屏封顶 1100 */
    width: 90%;
    max-width: clamp(640px, 80vw, 1100px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.modal.modal-commerce-product .modal-content {
    overflow-y: auto;
    max-height: min(72vh, calc(92vh - 140px));
}

.commerce-modal-form .commerce-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.commerce-modal-form .commerce-modal-field-span {
    grid-column: 1 / -1;
}

.commerce-modal-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.commerce-modal-form input[type="text"],
.commerce-modal-form input[type="number"] {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 12px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.commerce-modal-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.commerce-modal-desc-block {
    margin-top: 4px;
}

.commerce-richtext-wrap {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--bg-tertiary);
}

.commerce-richtext-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.commerce-rt-btn {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.commerce-rt-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.commerce-richtext-sep {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

.commerce-richtext-editor {
    min-height: 160px;
    max-height: 240px;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    outline: none;
}

.commerce-richtext-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

.commerce-richtext-hint {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.commerce-modal-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.commerce-modal-checkbox input {
    width: auto;
    cursor: pointer;
}

.commerce-modal-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.commerce-modal-form-refined .commerce-modal-lead {
    margin: 0 0 14px 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.commerce-req {
    color: var(--accent-danger);
}

.commerce-field-hint {
    margin: 6px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.commerce-expire-inputs {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.commerce-expire-inputs input {
    flex: 1;
    min-width: 0;
}

.commerce-expire-inputs select {
    flex: 0 0 auto;
    min-width: 88px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.commerce-file-input-hidden {
    display: none;
}

.commerce-icon-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.commerce-btn-upload {
    padding: 6px 12px !important;
    font-size: 13px !important;
}

.commerce-icon-status {
    font-size: 12px;
    color: var(--text-muted);
}

.commerce-icon-preview {
    margin-top: 10px;
}

.commerce-icon-preview img {
    width: 100%;
    max-width: 250px;
    aspect-ratio: 3 / 2;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    object-fit: cover;
}

.commerce-desc-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.55;
    resize: vertical;
    font-family: inherit;
}

.commerce-desc-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.commerce-modal-actions-compact {
    margin-top: 18px;
    padding-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.commerce-modal-actions-compact .btn-secondary,
.commerce-modal-actions-compact .btn-primary {
    padding: 7px 16px;
    font-size: 13px;
}

.commerce-btn-submit-create {
    font-weight: 600;
}

.commerce-modal-select {
    width: auto;
    min-width: 80px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 12px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.commerce-modal-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

@media (max-width: 520px) {
    .commerce-modal-form .commerce-modal-grid {
        grid-template-columns: 1fr;
    }
}/* ===== 商店视图 ===== */
.store-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 4px 0;
}

.store-product-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.store-product-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.store-product-header {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 2;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.store-product-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.store-product-icon-placeholder {
    font-size: 48px;
    opacity: 0.5;
}

.store-product-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.store-product-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.store-product-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

.store-product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.store-product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.store-product-expire {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 999px;
}

.store-product-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.store-product-actions .btn-primary {
    padding: 6px 18px;
    font-size: 13px;
}

.store-convert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
}

.store-convert-dialog {
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #1f2328);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    max-width: 480px;
    width: 100%;
    padding: 24px;
}

.store-convert-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
}

.store-convert-lead {
    font-size: 14px;
    color: var(--text-muted, #57606a);
    margin: 0 0 16px;
    line-height: 1.6;
}

.store-convert-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    border-top: 1px solid var(--border-color, #d0d7de);
}

.store-convert-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #d0d7de);
    font-size: 14px;
}

.store-convert-list li span {
    color: var(--text-muted, #57606a);
}

.store-convert-list li strong {
    font-weight: 600;
}

.store-convert-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.store-convert-actions .btn-primary {
    padding: 8px 20px;
    font-size: 14px;
}

.commerce-modal-readonly-value {
    padding: 8px 12px;
    background: var(--bg-secondary, #f6f8fa);
    border: 1px solid var(--border-color, #d0d7de);
    border-radius: 6px;
    color: var(--text-muted, #57606a);
    font-size: 13px;
}

.store-loading-tip,
.store-empty-tip,
.store-error-tip {
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    grid-column: 1 / -1;
}

.store-error-tip {
    color: var(--accent-danger);
}

/* ===== 我的视图（个人中心）===== */

#profile-view {
    width: 100%;
    margin: 0;
}

/* 用户信息卡片 */
.profile-user-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(88, 166, 255, 0.14), transparent 34%),
        linear-gradient(135deg, rgba(22, 27, 34, 0.98), rgba(28, 33, 40, 0.94));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.profile-user-card:hover {
    border-color: rgba(88, 166, 255, 0.3);
    box-shadow: var(--shadow-md);
}

.profile-user-avatar-wrap {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.15), rgba(163, 113, 247, 0.1));
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.profile-user-info {
    flex: 1;
    min-width: 0;
}

.profile-user-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-user-id-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-user-id-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-user-id-value {
    font-family: 'Consolas', 'SF Mono', 'Monaco', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.08em;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.2);
    padding: 2px 10px;
    border-radius: 6px;
}

.profile-section {
    width: 100%;
    padding: 18px;
    background: rgba(22, 27, 34, 0.72);
    border: 1px solid rgba(48, 54, 61, 0.88);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.profile-section + .profile-section {
    margin-top: 20px;
}

.profile-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.profile-section-title-row .profile-section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.profile-section-subtitle {
    margin-top: -6px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.profile-preferences-section {
    margin-bottom: 24px;
}

.profile-preferences-form {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(180px, 260px) auto;
    gap: 12px;
    align-items: end;
    justify-content: start;
}

.profile-preferences-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.profile-preferences-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.profile-preferences-field select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}

.profile-preferences-form .btn-small {
    min-width: 96px;
    width: auto;
    justify-self: start;
    white-space: nowrap;
}

.profile-preferences-status {
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(248, 81, 73, 0.25);
    color: var(--accent-danger);
    background: rgba(248, 81, 73, 0.08);
    font-size: 12px;
}

.profile-preferences-status.completed {
    border-color: rgba(63, 185, 80, 0.25);
    color: var(--accent-success);
    background: rgba(63, 185, 80, 0.08);
}

.profile-preferences-tip {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
}

.user-preferences-onboarding-form .profile-preferences-tip {
    margin-top: 0;
    margin-bottom: 4px;
    line-height: 1.5;
}

@media (max-width: 760px) {
    .profile-preferences-form {
        grid-template-columns: 1fr;
    }

    .profile-preferences-form .btn-small {
        justify-self: end;
    }
}

.profile-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
    justify-content: start;
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .profile-quick-actions {
        grid-template-columns: 1fr;
    }
}

.profile-action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background:
        linear-gradient(145deg, rgba(33, 38, 45, 0.92), rgba(22, 27, 34, 0.96));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.profile-action-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    background: var(--bg-tertiary);
    transform: translateY(-1px);
}

.profile-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.18), rgba(63, 185, 80, 0.08));
    border: 1px solid rgba(88, 166, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-primary);
}

.profile-action-body {
    flex: 1;
    min-width: 0;
}

.profile-action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.profile-action-desc {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.45;
}

.profile-action-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: var(--transition);
}

.profile-action-card:hover .profile-action-arrow {
    color: var(--accent-primary);
    transform: translateX(2px);
}

.profile-services-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.service-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 12px 16px;
    transition: var(--transition);
    flex: 0 1 auto;
    max-width: 100%;
}

.service-card:hover {
    border-color: var(--accent-primary);
}

.service-card-left {
    flex-shrink: 0;
}

.service-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    object-fit: cover;
}

.service-card-icon-placeholder {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.service-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.service-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.service-expire-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.service-expire-permanent {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.service-expire-normal {
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-primary);
}

.service-expire-urgent {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

/* 订单状态徽标 */
.order-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.order-status-badge.status-paid {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.order-status-badge.status-pending {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-warning);
}

.order-status-badge.status-refunded {
    background: rgba(163, 113, 247, 0.12);
    color: var(--accent-purple);
}

.order-status-badge.status-failed {
    background: rgba(248, 81, 73, 0.12);
    color: var(--accent-danger);
}

.order-status-badge.status-gift {
    background: rgba(56, 139, 253, 0.12);
    color: var(--accent-info, #388bfd);
}

/* 工单 */
.profile-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.support-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.support-status-running {
    color: var(--accent-warning);
    background: rgba(210, 153, 34, 0.14);
}

.support-status-pending {
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.12);
}

.support-status-completed {
    color: var(--accent-success);
    background: rgba(63, 185, 80, 0.12);
}

.support-detail-row td {
    background: rgba(88, 166, 255, 0.04);
}

.support-chat-box {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.modal-support-detail .support-chat-box {
    flex: 1;
    min-height: 0;
}

.support-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
    padding: 12px;
}

.modal-support-detail .support-messages {
    flex: 1;
    min-height: 260px;
    max-height: none;
}

.support-message {
    max-width: 78%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.support-message.user {
    align-self: flex-end;
    border-color: rgba(88, 166, 255, 0.25);
    background: rgba(88, 166, 255, 0.10);
}

.support-message.admin {
    align-self: flex-start;
}

.support-message-meta {
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.support-message-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.support-message-files,
.support-pending-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.support-message-files {
    margin-top: 8px;
}

.support-pending-files {
    margin: 0 0 6px;
}

.support-file-link,
.support-pending-file {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.08);
    font-size: 12px;
}

.support-pending-file button {
    color: var(--text-muted);
}

.support-composer-box .support-pending-files:not(:empty) {
    padding: 10px 12px 0;
}

.support-composer {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.support-composer-box {
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.support-composer-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.08);
}

.support-textarea {
    display: block;
    width: 100%;
    min-height: 40px;
    max-height: 160px;
    resize: none;
    overflow-y: auto;
    padding: 10px 12px 4px;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    line-height: 1.5;
}

.support-textarea::placeholder {
    color: var(--text-muted);
}

.support-composer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 4px 10px 8px;
}

.support-attach-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 16px;
    transition: var(--transition);
}

.support-attach-btn:hover {
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-primary);
}

.support-composer-hint {
    flex: 1;
    color: var(--text-muted);
    font-size: 12px;
}

.support-send-btn {
    padding: 5px 14px;
    background: var(--accent-primary);
    color: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.support-send-btn:hover {
    background: #4193ef;
    transform: translateY(-1px);
}

.support-create-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-create-form .commerce-input,
#support-view .commerce-input,
#support-view .commerce-input-plain {
    width: 100%;
    padding: 8px 10px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* ===== 工单处理（admin） ===== */
#support-view .commerce-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

#support-view .commerce-card-gap {
    margin-top: 16px;
}

#support-view .section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 18px 0;
}

#support-view .commerce-filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

#support-view .commerce-col {
    flex: 1;
    min-width: 180px;
}

#support-view .commerce-label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

#support-view .commerce-filter-row input,
#support-view .commerce-filter-row select,
#support-view .commerce-table select.commerce-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 36px 10px 14px;
    font-size: 15px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
}

#support-view .commerce-filter-row input::placeholder {
    color: var(--text-muted);
}

#support-view .commerce-filter-row select,
#support-view .commerce-table select.commerce-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b949e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

#support-view .commerce-filter-row select option,
#support-view .commerce-table select.commerce-input option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#support-view .commerce-filter-row input:focus,
#support-view .commerce-filter-row select:focus,
#support-view .commerce-table select.commerce-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

#support-view .commerce-filter-actions {
    display: flex;
    align-items: flex-end;
    padding-bottom: 1px;
}

#support-view .commerce-filter-actions .btn-primary {
    padding: 10px 22px;
    font-size: 15px;
    white-space: nowrap;
}

#support-view .commerce-table-wrap {
    overflow-x: auto;
    margin-top: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

#support-view .commerce-table {
    width: 100%;
    min-width: 1080px;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 15px;
}

#support-view .commerce-table thead th {
    padding: 12px 14px;
    text-align: left;
    white-space: nowrap;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--border-color);
}

#support-view .commerce-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

#support-view .commerce-table tbody tr {
    transition: var(--transition);
}

#support-view .commerce-table tbody tr:hover {
    background: rgba(88, 166, 255, 0.04);
}

#support-view .commerce-table tbody tr:last-child td {
    border-bottom: none;
}

#support-view .commerce-table th:nth-child(1),
#support-view .commerce-table td:nth-child(1) {
    width: 190px;
}

#support-view .commerce-table th:nth-child(2),
#support-view .commerce-table td:nth-child(2) {
    width: 92px;
}

#support-view .commerce-table th:nth-child(3),
#support-view .commerce-table td:nth-child(3) {
    width: 96px;
}

#support-view .commerce-table th:nth-child(4),
#support-view .commerce-table td:nth-child(4),
#support-view .commerce-table th:nth-child(5),
#support-view .commerce-table td:nth-child(5) {
    width: 130px;
}

#support-view .commerce-table th:nth-child(7),
#support-view .commerce-table td:nth-child(7) {
    width: 180px;
}

#support-view .commerce-table th:nth-child(8),
#support-view .commerce-table td:nth-child(8) {
    width: 150px;
}

#support-view .commerce-table tbody td:nth-child(6) {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

#support-view .commerce-table select.commerce-input {
    min-width: 0;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 14px;
}

#support-view .commerce-code {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 6px;
}

#support-view .commerce-empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 10px !important;
    white-space: normal;
}

#support-view .commerce-muted {
    color: var(--text-muted);
    font-size: 14px;
}

#support-view .commerce-pagination {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
}

#support-view .commerce-page-info {
    color: var(--text-muted);
}

#support-view .commerce-pagination .btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#support-view .support-actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#support-view .btn-small {
    white-space: nowrap;
}

@media (max-width: 768px) {
    #support-view .commerce-filter-actions,
    #support-view .commerce-filter-actions .btn-primary {
        width: 100%;
    }
}

/* ===== 运维工具（admin） ===== */
#ops-view .commerce-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

#ops-view .section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 18px 0;
}

#ops-view .commerce-filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

#ops-view .commerce-col {
    flex: 1;
    min-width: 220px;
}

#ops-view .commerce-label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

#ops-view .commerce-filter-row input,
#ops-view .commerce-filter-row select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 14px;
    font-size: 15px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
}

#ops-view .commerce-filter-row input::placeholder {
    color: var(--text-muted);
}

#ops-view .commerce-filter-row select {
    cursor: pointer;
}

#ops-view .commerce-filter-row input:focus,
#ops-view .commerce-filter-row select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

#ops-view .commerce-filter-actions {
    display: flex;
    align-items: flex-end;
    padding-bottom: 1px;
}

#ops-view .commerce-filter-actions .btn-primary {
    padding: 10px 24px;
}

#ops-view .ops-tool-hint {
    margin: 14px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

@media (max-width: 768px) {
    #ops-view .commerce-filter-actions,
    #ops-view .commerce-filter-actions .btn-primary {
        width: 100%;
    }
}

.support-empty {
    color: var(--text-muted);
    text-align: center;
}

.support-feedback-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid rgba(88, 166, 255, 0.20);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.10), rgba(163, 113, 247, 0.08));
}

.support-feedback-title {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
}

.support-feedback-sub {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.support-feedback-contact-title {
    margin-bottom: 12px;
}

/* ===== 礼品（gifts）视图 ===== */
#gifts-view .commerce-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

#gifts-view .commerce-page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

#gifts-view .commerce-page-sub {
    margin: 6px 0 0 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 680px;
}

#gifts-view .gift-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 20px;
    max-width: 960px;
}

@media (max-width: 900px) {
    #gifts-view .gift-layout {
        grid-template-columns: 1fr;
    }
}

#gifts-view .card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}

/* 预览卡片 */
#gifts-view .gift-preview-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

#gifts-view .gift-preview-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 80% at 0% 0%, rgba(88, 166, 255, 0.08), transparent 60%);
    pointer-events: none;
}

#gifts-view .gift-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

#gifts-view .gift-preview-kicker {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

#gifts-view .gift-preview-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 999px;
    background: rgba(139, 148, 158, 0.12);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

#gifts-view .gift-preview-state.is-active {
    background: rgba(63, 185, 80, 0.14);
    color: var(--accent-success);
    border-color: rgba(63, 185, 80, 0.35);
}

#gifts-view .gift-preview-state.is-active::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-success);
    box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.2);
}

#gifts-view .gift-preview-body {
    position: relative;
    min-height: 140px;
    display: flex;
}

#gifts-view .gift-preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0;
    text-align: center;
    color: var(--text-muted);
}

#gifts-view .gift-preview-empty-icon {
    font-size: 34px;
    opacity: 0.6;
    margin-bottom: 2px;
}

#gifts-view .gift-preview-empty-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

#gifts-view .gift-preview-empty-sub {
    font-size: 12px;
    color: var(--text-muted);
}

#gifts-view .gift-preview-item {
    display: flex;
    gap: 16px;
    width: 100%;
    align-items: center;
}

#gifts-view .gift-preview-thumb {
    flex: 0 0 88px;
    width: 88px;
    height: 88px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-muted);
}

#gifts-view .gift-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#gifts-view .gift-preview-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#gifts-view .gift-preview-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#gifts-view .gift-preview-key {
    font-family: "SFMono-Regular", Menlo, monospace;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 6px;
    align-self: flex-start;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

#gifts-view .gift-preview-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
}

#gifts-view .gift-preview-meta span strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 4px;
}

/* 表单卡片 */
#gifts-view .gift-form-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#gifts-view .gift-form-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

#gifts-view .gift-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#gifts-view .gift-form-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

#gifts-view .gift-form-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

#gifts-view .gift-product-select {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%238b949e' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

#gifts-view .gift-product-select:hover {
    border-color: rgba(88, 166, 255, 0.4);
}

#gifts-view .gift-product-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

#gifts-view .gift-product-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#gifts-view .gift-save-btn {
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 500;
    flex: 0 0 auto;
    white-space: nowrap;
}

#gifts-view .gift-form-hint {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.text-muted {
    color: var(--text-muted);
}

/* ===== 图片裁剪弹窗 ===== */
.image-crop-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-crop-dialog {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    width: 100%;
    max-width: 540px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.image-crop-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.image-crop-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.image-crop-close:hover {
    color: var(--text-primary);
}

.image-crop-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.image-crop-canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.image-crop-canvas-wrap:active {
    cursor: grabbing;
}

.image-crop-canvas-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.image-crop-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.image-crop-zoom-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
}

.image-crop-zoom-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.image-crop-zoom-slider {
    flex: 1;
    accent-color: var(--accent-primary, #3b82f6);
}

.image-crop-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
}

.image-crop-footer .btn-primary,
.image-crop-footer .btn-secondary {
    flex: none;
}

/* ===== 应用配置向导 Wizard ===== */

/* 向导顶部流程条 */
/* 向导左右布局 */
.wizard-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧纵向tab栏 */
.wizard-sidebar {
    width: 160px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 12px 0;
    overflow-y: auto;
}

.wizard-sidebar-tab {
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.wizard-sidebar-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.wizard-sidebar-tab.active {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    border-left-color: var(--accent-primary);
    font-weight: 600;
}

/* 向导内容区域 */
.wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.wizard-step-panel {
    display: none;
}

.wizard-step-panel.active {
    display: block;
}

/* 向导头部操作按钮 */
.wizard-header-actions {
    display: flex;
    gap: 8px;
}

/* 向导视图布局 */
#client-config-view.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.wizard-view-header {
    flex-shrink: 0;
}

/* 环境切换标签 */
.wizard-env-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.wizard-env-tab {
    padding: 6px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
    margin-bottom: -1px;
}

.wizard-env-tab:hover {
    color: var(--text-primary);
}

.wizard-env-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 500;
}

/* 基础设施表单网格 */
.infra-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px 20px;
}

/* 服务器步骤表单容器：服务器类型下拉在上，类型对应表单在下 */
.server-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 520px;
}

.server-mode-field {
    max-width: 240px;
}

.server-type-hint {
    margin-top: 6px;
    color: var(--text-muted, var(--text-secondary));
    font-size: 12px;
    line-height: 1.5;
}

/* 向导里的深色下拉（与 .domain-select 保持一致；新增类以便在其它步骤复用） */
.cfg-dark-select {
    width: 100%;
    padding: 8px 32px 8px 12px;
    background-color: var(--bg-tertiary);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%238b949e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cfg-dark-select:hover:not(:disabled) {
    border-color: var(--accent-primary);
}

.cfg-dark-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15);
}

.cfg-dark-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 下拉菜单项：强制使用深色背景（仅 Chromium/Firefox 可生效，Safari 受限于系统样式） */
.cfg-dark-select option,
.cfg-dark-select optgroup {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 基础设施列表 */
.infra-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.infra-list-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.domain-list-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.domain-public-notice {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.domain-public-notice code {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
}

.infra-list-row input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 13px;
}

.infra-list-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15);
}

/* 域名步骤的下拉：与整体深色表单保持一致，替换浏览器默认样式 */
.infra-list-row select,
.domain-select {
    flex: 1;
    padding: 8px 32px 8px 12px;
    background-color: var(--bg-tertiary);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%238b949e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.infra-list-row select:hover:not(:disabled),
.domain-select:hover:not(:disabled) {
    border-color: var(--accent-primary);
}

.infra-list-row select:focus,
.domain-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15);
}

.infra-list-row select:disabled,
.domain-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 下拉列表项：强制使用深色背景，Firefox 和 Chromium 对 option 支持都有限，
   仅设置最基础的背景与文字色，确保打开时不再出现白底黑字 */
.infra-list-row select option,
.domain-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 域名步骤的行：单选场景下内容不宜太宽，控制最大宽度并左对齐 */
#domains-list.infra-list {
    max-width: 520px;
}

/* 基础设施卡片（数据库） */
.infra-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin-bottom: 12px;
}

.infra-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.infra-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* 必填标记 */
.required-mark {
    color: var(--accent-danger);
    margin-left: 2px;
}

/* 向导步骤标题下的副标题 */
.wizard-step-panel .config-section-subtitle {
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== 权限配置视图 ===== */

#permissions-view .perm-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

#permissions-view .section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.perm-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.perm-group-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.perm-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.perm-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.perm-key-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

.perm-type-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
}

.perm-type-sub {
    background: rgba(52, 199, 89, 0.15);
    color: var(--accent-success);
}

.perm-type-count {
    background: rgba(255, 149, 0, 0.15);
    color: var(--accent-warning);
}

.perm-type-desc {
    font-size: 12px;
    color: var(--text-muted);
}

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

.perm-table thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.perm-table tbody td {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.perm-table tbody tr:last-child td {
    border-bottom: none;
}

.perm-table tbody tr:hover {
    background: var(--bg-secondary);
}

.perm-actions-cell {
    white-space: nowrap;
}

.perm-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.perm-action-btn:hover {
    opacity: 1;
    background: var(--bg-primary);
}

.perm-text-muted {
    color: var(--text-muted);
    font-style: italic;
}

.perm-empty,
.perm-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 0;
    font-size: 14px;
}

/* 通用弹窗覆盖层 */
.commerce-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.perm-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.2s ease;
}

.perm-modal .commerce-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.perm-modal .commerce-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.perm-modal .commerce-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.perm-modal .commerce-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.perm-form {
    padding: 20px;
}

.perm-form .commerce-form-group {
    margin-bottom: 16px;
}

.perm-form .commerce-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.perm-form .commerce-label .required {
    color: var(--accent-danger);
}

.perm-form .commerce-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.perm-form .commerce-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15);
}

.perm-form .commerce-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

.perm-form .commerce-modal-footer .btn-primary,
.perm-form .commerce-modal-footer .btn-secondary {
    width: auto;
    padding: 8px 20px;
    font-size: 13px;
    white-space: nowrap;
}

.perm-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 权限配置视图复用 commerce-page-head 样式 */
#permissions-view .commerce-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}

#permissions-view .commerce-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

#permissions-view .commerce-page-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
}

#permissions-view .commerce-add-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid rgba(88, 166, 255, 0.45);
    box-shadow: none;
    transition: var(--transition);
    flex-shrink: 0;
}

#permissions-view .commerce-add-product-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
}

#permissions-view .commerce-add-icon {
    font-size: 15px;
    line-height: 1;
    font-weight: 500;
    opacity: 0.9;
}

/* ===== 用户资源（admin） ===== */

#user-resources-view .commerce-page-head {
    margin-bottom: 20px;
}

#user-resources-view .ur-search-panel,
#user-resources-view .ur-summary-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
}

#user-resources-view .ur-search-panel {
    padding: 0;
}

#user-resources-view .ur-search-bar {
    margin-bottom: 0;
    border: none;
    background: transparent;
}

#user-resources-view .ur-summary-panel {
    padding: 20px 24px;
}

#user-resources-view .ur-section + .ur-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

#user-resources-view .ur-section-title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

#user-resources-view .ur-user-line {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

#user-resources-view .ur-agent-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

#user-resources-view .ur-server-select {
    min-width: 280px;
    max-width: 420px;
    flex: 1;
}

#user-resources-view .ur-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

#user-resources-view .ur-hint-warn {
    color: var(--warning, #d29922);
}

#user-resources-view .ur-clients-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#user-resources-view .ur-client-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

#user-resources-view .ur-client-card-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

#user-resources-view .ur-client-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;
    margin: 0;
    font-size: 13px;
}

#user-resources-view .ur-client-meta dt {
    display: inline;
    margin: 0;
    color: var(--text-tertiary);
    font-weight: normal;
}

#user-resources-view .ur-client-meta dt::after {
    content: '：';
}

#user-resources-view .ur-client-meta dd {
    display: inline;
    margin: 0;
    color: var(--text-secondary);
    word-break: break-all;
}

#user-resources-view .ur-empty-state,
#user-resources-view .ur-empty-inline {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-tertiary);
    font-size: 14px;
}

#user-resources-view .ur-empty-state {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

#user-resources-client-modal .ur-client-modal {
    max-width: 560px;
}

#user-resources-client-modal .ur-client-form .commerce-input,
#user-resources-client-modal .ur-server-select {
    width: 100%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

#user-resources-client-modal .ur-server-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

#user-resources-client-modal .ur-domain-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

#user-resources-client-modal .ur-domains-list {
    margin-top: 10px;
    max-width: 100%;
}

#user-resources-client-modal .ur-domains-empty {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-tertiary);
}

#user-resources-client-modal .btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

@media (max-width: 720px) {
    #user-resources-view .ur-client-meta {
        grid-template-columns: 1fr;
    }

    #user-resources-view .ur-client-card {
        flex-direction: column;
    }
}

/* ===== 资源管理 ===== */

#resources-view .commerce-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

#resources-view .commerce-add-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--accent-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

#resources-view .commerce-add-product-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
}

#resources-view .commerce-add-icon {
    font-size: 15px;
    line-height: 1;
    font-weight: 500;
    opacity: 0.9;
}

.resource-table {
    width: 100%;
}

.resources-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.resources-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.resources-filter-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* .commerce-input 本身没有全局样式，只在 .perm-form / .resource-modal 等父级下才
   补了深色背景；筛选条在 .card 内没有这些父级，因此此处补全，保持与页面深色主题一致 */
.resources-filter-bar .commerce-input {
    width: auto;
    min-width: 140px;
    padding: 6px 10px;
    font-size: 13px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.resources-filter-bar .commerce-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.resources-filter-bar select.commerce-input {
    /* 隐藏原生下拉箭头，用 SVG 画一个浅色的，避免 Windows / 某些浏览器在深色背景上
       渲染出白底箭头 */
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* 原生 <option> 在部分系统（macOS / Windows）会沿用系统默认样色；
   给 option 显式指定背景 / 前景色，确保展开列表也是深色风格。 */
.resources-filter-bar select.commerce-input option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.resources-filter-reset {
    padding: 6px 14px;
    white-space: nowrap;
}

.resources-filter-summary {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0 0 8px 0;
}

/* 表单字段下方的灰色说明文字（字段作用 / 限制），字号比 label 小一档 */
.commerce-form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.resource-env-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
    margin-right: 4px;
}

.resource-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.resource-status-online {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-success);
}

.resource-status-offline {
    background: rgba(139, 148, 158, 0.15);
    color: var(--text-tertiary);
}

.resource-url-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    /* 自适应宽度：笔记本 ≥520，常规屏 ~80vw，超大屏封顶 1100；
       小屏走 width:90% 兜底 */
    width: 90%;
    max-width: clamp(520px, 80vw, 1100px);
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.2s ease;
}

.resource-modal .commerce-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.resource-modal .commerce-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.resource-modal .commerce-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.resource-modal .commerce-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.resource-modal .commerce-form {
    padding: 20px;
}

.resource-modal .commerce-form-group {
    margin-bottom: 16px;
}

.resource-modal .commerce-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.resource-modal .commerce-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-sizing: border-box;
}

.resource-modal .commerce-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15);
}

.resource-secret-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.resource-secret-wrap .commerce-input {
    padding-right: 36px;
}

.resource-secret-toggle {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    line-height: 1;
    opacity: 0.6;
}

.resource-secret-toggle:hover {
    opacity: 1;
}

/* 资源表单：多行 PEM 与按钮并排；掩码用 WebKit 圆点（Chrome/Edge 等） */
.resource-secret-wrap--multiline {
    align-items: flex-start;
}

.resource-secret-wrap--multiline .commerce-input {
    flex: 1;
    min-width: 0;
}

.resource-secret-wrap--multiline .resource-secret-toggle--multiline {
    position: relative;
    right: auto;
    margin-top: 6px;
    flex-shrink: 0;
}

textarea.commerce-input.resource-textarea-secret-masked {
    -webkit-text-security: disc;
}

/* 资源多选 checkbox 组（如服务器业务） */
.resource-multi-checkbox {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.resource-multi-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-primary);
}

.resource-multi-checkbox-item input[type="checkbox"] {
    margin: 0;
    flex: none;
    accent-color: var(--accent-primary);
}

/* token 多 config 列表 */
.resource-token-configs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resource-token-config-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.resource-token-config-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.resource-token-config-item-title {
    font-weight: 500;
}

.resource-token-config-item-remove {
    width: auto;
    padding: 4px 10px;
    font-size: 12px;
    background: transparent;
    color: #f87171;
    border: 1px solid #f87171;
    border-radius: 6px;
    cursor: pointer;
}

.resource-token-config-item-remove:hover {
    background: rgba(248, 113, 113, 0.12);
}

.resource-token-config-item-remove:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.resource-token-config-item textarea.commerce-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    min-height: 160px;
    resize: vertical;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.resource-token-config-add-btn {
    width: auto;
    margin-top: 8px;
    padding: 8px 16px;
}

/* 秘钥列表：掩码 + 显示切换 */
.secret-value-cell {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.secret-val-code {
    font-size: 12px;
    word-break: break-all;
    flex: 1;
    min-width: 0;
    margin: 0;
}

.btn-secret-visibility {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    opacity: 0.65;
}

.btn-secret-visibility:hover {
    opacity: 1;
}

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrap input {
    padding-right: 36px !important;
    flex: 1;
}

.password-toggle-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    line-height: 1;
    opacity: 0.6;
}

.password-toggle-btn:hover {
    opacity: 1;
}

.password-toggle-btn:disabled {
    cursor: pointer;
    opacity: 0.6;
}

.resource-env-checkboxes {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.resource-env-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.resource-env-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.resource-modal .commerce-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

.resource-modal .commerce-modal-footer .btn-primary,
.resource-modal .commerce-modal-footer .btn-secondary {
    width: auto;
    padding: 8px 20px;
    font-size: 13px;
    white-space: nowrap;
}

.resource-extra-divider {
    padding: 12px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

/* 资源弹窗 —— 同一行横向布局：基础四项 / token plan 补充信息四项 */
.resource-form-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.resource-form-row > .commerce-form-group {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .resource-form-row {
        flex-direction: column;
        gap: 12px;
    }
}

/* 细分模型列表表格 */
.resource-sub-models-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 4px;
}

.resource-sub-models-table th,
.resource-sub-models-table td {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    color: var(--text-primary);
}

.resource-sub-models-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
}

.resource-sub-models-table .commerce-input {
    margin: 0;
    padding: 6px 8px;
    font-size: 13px;
}

.resource-sub-models-add-btn {
    margin-top: 8px;
    width: auto;
    padding: 6px 12px;
}

.resource-sub-model-action-btn {
    width: auto;
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.resource-sub-model-action-btn + .resource-sub-model-action-btn {
    margin-left: 6px;
}

.resource-sub-model-action-btn:hover {
    background: var(--bg-tertiary);
}

.resource-sub-model-action-btn--danger {
    color: #d33;
}

/* 子模型 config 编辑弹窗：复用 commerce-modal 风格但层级稍高 */
.sub-model-config-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.sub-model-config-dialog {
    width: min(720px, 92vw);
    max-height: 92vh;
    overflow-y: auto;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sub-model-config-dialog h4 {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
}

.sub-model-config-dialog textarea {
    width: 100%;
    min-height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    font-family: ui-monospace, "Menlo", "Monaco", monospace;
    font-size: 13px;
    line-height: 1.5;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    resize: vertical;
    box-sizing: border-box;
}

.sub-model-config-dialog .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.sub-model-config-dialog .btn-primary,
.sub-model-config-dialog .btn-secondary {
    width: auto;
    padding: 6px 16px;
    font-size: 13px;
}

/* 细分模型 config 的 key 白名单提示块：弹窗里展示「凭据类」与
 * 「模型/行为类」两段；与 textarea 同宽，左侧细 border 颜色区分类别。
 * apiserver 端的真实白名单常量见 ``MODEL_ENV_PASSTHROUGH_KEYS``；
 * 任一处增删 key 后另一处必须同步更新，否则 admin 看到的提示会与后端实际接受 key 不一致。 */
.sub-model-config-keys-help {
    margin: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow: hidden;
}

.sub-model-config-keys-help__title {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.sub-model-config-keys-help__section {
    padding: 10px 12px;
    border-left: 3px solid transparent;
}

.sub-model-config-keys-help__section + .sub-model-config-keys-help__section {
    border-top: 1px solid var(--border-color);
}

.sub-model-config-keys-help__section--credential {
    border-left-color: var(--accent-warning);
}

.sub-model-config-keys-help__section--passthrough {
    border-left-color: var(--accent-primary);
}

.sub-model-config-keys-help__section-title {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.sub-model-config-keys-help__group {
    margin: 0 0 8px 0;
}

.sub-model-config-keys-help__group:last-child {
    margin-bottom: 0;
}

.sub-model-config-keys-help__group-label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-size: 11.5px;
}

.sub-model-config-keys-help__keys {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
}

.sub-model-config-keys-help__keys li {
    font-family: ui-monospace, "Menlo", "Monaco", monospace;
    font-size: 11.5px;
    color: var(--text-primary);
    padding: 1px 0;
}

.resource-hint-text {
    margin: 0;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* 商品编辑弹窗内的限速资源包配置 */
.commerce-modal-bundle-section {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.commerce-modal-bundle-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.commerce-modal-bundle-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.commerce-modal-bundle-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.commerce-modal-bundle-quota-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* 限速资源包整体 5h 输入：覆盖 .commerce-modal-form input[type=number] 的 100% 宽度，
   保证 label / input / 按钮三者都贴合内容并保持单行 */
.commerce-modal-form .commerce-modal-bundle-actions input[type="number"].commerce-modal-bundle-num,
.commerce-modal-bundle-actions input.commerce-modal-bundle-num {
    width: 100px;
    min-width: 80px;
    flex: 0 0 100px;
    padding: 6px 10px;
}

/* 头部允许在窄屏换行，但桌面始终两端对齐单行 */
.commerce-modal-bundle-head {
    flex-wrap: wrap;
    gap: 8px 12px;
}

.commerce-modal-bundle-actions .btn-secondary,
.commerce-modal-bundle-actions .btn-primary {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
}

.commerce-modal-bundle-hint {
    margin-bottom: 12px;
}

.commerce-modal-bundle-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: var(--text-primary);
}

.commerce-modal-bundle-table th,
.commerce-modal-bundle-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.commerce-modal-bundle-table th {
    color: var(--text-secondary);
    font-weight: 500;
    background: var(--bg-secondary);
}

.commerce-modal-bundle-num,
.commerce-modal-form input[type="number"].commerce-modal-bundle-num,
.commerce-modal-form input[type="text"].commerce-modal-bundle-num {
    width: 80px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 12px;
    box-sizing: border-box;
}

.commerce-modal-bundle-remove {
    width: auto;
    padding: 4px 10px;
    font-size: 12px;
    background: transparent;
    color: #f87171;
    border: 1px solid #f87171;
    border-radius: 6px;
    cursor: pointer;
}

.commerce-modal-bundle-remove:hover {
    background: rgba(248, 113, 113, 0.12);
}

.commerce-modal-readonly-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

#admin-product-key[readonly] {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* 资源选择弹层（添加 token 资源到限速包） */
.commerce-modal-bundle-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.commerce-modal-bundle-picker {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 540px;
    color: var(--text-primary);
}

.commerce-modal-bundle-picker p {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.commerce-modal-bundle-picker select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
    margin-bottom: 12px;
}

.commerce-modal-bundle-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.commerce-modal-bundle-picker-row label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.commerce-modal-bundle-picker .btn-secondary,
.commerce-modal-bundle-picker .btn-primary {
    width: auto;
    padding: 6px 14px;
    font-size: 13px;
}

/* 添加应用选择弹窗 */
.add-client-choice .choice-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-client-choice .choice-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    flex-wrap: wrap;
}

.add-client-choice .choice-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.add-client-choice .choice-option input[type="radio"] {
    margin-top: 2px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.add-client-choice .choice-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.add-client-choice .choice-recommend-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: var(--accent-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    vertical-align: middle;
}

.add-client-choice .choice-desc {
    width: 100%;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 24px;
}

.add-client-choice .form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.add-client-choice .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.add-client-choice .checkbox-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition);
    white-space: nowrap;
    flex: none;
}

.add-client-choice .checkbox-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.add-client-choice .checkbox-option input[type="checkbox"] {
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* 模板单选样式（与 checkbox 视觉对齐） */
.add-client-choice .radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.add-client-choice .radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition);
    white-space: nowrap;
    flex: none;
}

.add-client-choice .radio-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.add-client-choice .radio-option input[type="radio"] {
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* ===== 应用配置向导 Wizard ===== */

/* 向导顶部流程条 */
.wizard-flow-bar {
    display: flex;
    align-items: center;
    padding: 16px 24px 0;
    overflow-x: auto;
    flex-shrink: 0;
    gap: 0;
}

.wizard-step-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.wizard-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wizard-step-node.active .wizard-step-dot {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.wizard-step-node.done .wizard-step-dot {
    background: var(--accent-success);
    border-color: var(--accent-success);
}

.wizard-step-node.done .wizard-step-dot::after {
    content: '✓';
    color: white;
    font-size: 13px;
    font-weight: bold;
}

.wizard-step-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: center;
    transition: var(--transition);
}

.wizard-step-node.active .wizard-step-label {
    color: var(--accent-primary);
    font-weight: 600;
}

.wizard-step-node.done .wizard-step-label {
    color: var(--accent-success);
}

.wizard-step-connector {
    flex: 1;
    min-width: 20px;
    height: 2px;
    background: var(--border-color);
    margin-bottom: 20px;
    flex-shrink: 0;
}

/* 向导内容区域 */
.wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.wizard-step-panel {
    display: none;
}

.wizard-step-panel.active {
    display: block;
}

/* 向导底部操作栏 */
.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.wizard-footer-left {
    display: flex;
    gap: 8px;
}

.wizard-footer-right {
    display: flex;
    gap: 8px;
}

/* 完成按钮 */
.btn-success {
    padding: 8px 20px;
    background: var(--accent-success);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.btn-success:hover {
    opacity: 0.85;
}

/* ===== 部署配置 ===== */

.deploy-card {
    margin-bottom: 16px;
    padding: 16px 20px;
}

.deploy-card .form-group {
    margin-bottom: 14px;
}

.deploy-card .form-group:last-child {
    margin-bottom: 0;
}

.deploy-official-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.deploy-official-row-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex: none;
}

.deploy-official-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.deploy-official-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg-tertiary, #f5f5f5);
    transition: background 0.15s;
}

.deploy-official-label:hover {
    background: var(--bg-secondary, #eaeaea);
}

.deploy-official-label input[type="checkbox"] {
    margin: 0;
    accent-color: var(--accent-primary, #58a6ff);
}

.deploy-uuid-badge {
    display: inline-block;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    margin-left: 8px;
}

.deploy-custom-input {
    width: 100%;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

/* 部署预览模态框 */
.modal-container {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.2s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 4px;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

/* ===== 反馈渠道（admin 管理页） ===== */

#feedback-channels-view .commerce-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

#feedback-channels-view .commerce-page-head-text {
    min-width: 0;
}

#feedback-channels-view .commerce-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

#feedback-channels-view .commerce-page-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
}

#feedback-channels-view .commerce-add-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--accent-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

#feedback-channels-view .commerce-add-product-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
}

#feedback-channels-view .commerce-add-icon {
    font-size: 15px;
    line-height: 1;
    font-weight: 500;
    opacity: 0.9;
}

.feedback-channel-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    max-width: 520px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.2s ease;
}

.feedback-channel-modal .commerce-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.feedback-channel-modal .commerce-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.feedback-channel-modal .commerce-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.feedback-channel-modal .commerce-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.feedback-channel-modal .commerce-form {
    padding: 20px;
}

.feedback-channel-modal .commerce-form-group {
    margin-bottom: 16px;
}

.feedback-channel-modal .commerce-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.feedback-channel-modal .commerce-label .required {
    color: var(--accent-danger);
}

.feedback-channel-modal .commerce-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-sizing: border-box;
}

.feedback-channel-modal .commerce-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15);
}

.feedback-channel-modal .commerce-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

.feedback-channel-modal .commerce-modal-footer .btn-primary,
.feedback-channel-modal .commerce-modal-footer .btn-secondary {
    width: auto;
    padding: 8px 20px;
    font-size: 13px;
    white-space: nowrap;
}

.feedback-qr-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.feedback-qr-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.feedback-qr-url-input {
    margin-top: 4px;
}

.feedback-qr-preview-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 8px;
}

.feedback-qr-preview-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.feedback-qr-clear-btn {
    background: none;
    border: none;
    color: var(--accent-danger);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 0;
}

.feedback-form-tip {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 8px 0 0;
}

.feedback-channel-qr-cell img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.feedback-channel-link-cell {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 侧栏 人工客服 入口（用户） ===== */

.sidebar-feedback-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-feedback-btn:hover {
    background: var(--bg-card);
    border-color: rgba(88, 166, 255, 0.45);
    color: var(--text-primary);
}

.sidebar-feedback-btn.active {
    background: rgba(88, 166, 255, 0.12);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.sidebar-feedback-icon {
    font-size: 16px;
}

/* ===== 人工客服页面（普通用户） ===== */

.user-feedback-list {
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feedback-page-loading,
.feedback-page-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 48px 0;
    font-size: 14px;
}

.feedback-channel-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary);
}

.feedback-channel-card-info {
    flex: 1;
    min-width: 0;
}

.feedback-channel-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feedback-channel-card-link a {
    color: var(--accent-primary, #58a6ff);
    font-size: 14px;
    word-break: break-all;
}

.feedback-channel-card-qr img {
    width: 240px;
    height: 240px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    padding: 8px;
    flex: none;
}

@media (max-width: 768px) {
    .feedback-channel-card {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .feedback-channel-card-qr {
        display: flex;
        justify-content: center;
    }

    .feedback-channel-card-qr img {
        width: min(240px, 80vw);
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

/* ===== Responsive: Hamburger Toggle & Overlay ===== */
.sidebar-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 99;
}

/* ===== Responsive: wide screens — proportionally distribute column widths =====
   On large monitors each fixed-px column would stay tiny while the auto title
   column ate all extra space. Switching to percentages lets every column scale
   with the viewport so the table fills the area evenly. The breakpoint is set
   to 1700px so laptop/normal-desktop widths (≤1680px) keep the existing px-tuned
   column widths — at lower viewport sizes the percentages would shrink the
   action/links columns below the threshold needed for the buttons to fit on a
   single row. */
@media (min-width: 1700px) {
    .tasks-table .task-col-id {
        width: 5%;
    }

    .tasks-table .task-col-status {
        width: 11%;
    }

    .tasks-table .task-col-client {
        width: 13%;
    }

    .tasks-table .task-col-created {
        width: 14%;
    }

    .tasks-table .task-col-actions {
        width: 17%;
    }

    .clients-table .client-col-id {
        width: 6%;
    }

    .clients-table .client-col-status {
        width: 10%;
    }

    .clients-table .client-col-links {
        width: 11%;
    }

    .clients-table .client-col-created {
        width: 13%;
    }

    .clients-table .client-col-actions {
        width: 15%;
    }
}

/* ===== Responsive: medium screens (laptop / small desktop) ===== */
@media (max-width: 1280px) {
    .main-content {
        padding: 20px;
    }

    /* Tighten fixed columns on laptops; title still absorbs the remainder and ellipses */
    .tasks-table .task-col-id {
        width: 64px;
    }

    .tasks-table .task-col-status {
        width: 120px;
    }

    .tasks-table .task-col-client {
        width: 130px;
    }

    .tasks-table .task-col-created {
        width: 150px;
    }

    .tasks-table .task-col-actions {
        width: 210px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 12px;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 200px;
    }

    .main-content {
        padding: 16px;
    }

    .view-header h2 {
        font-size: 20px;
    }

    .tasks-table .task-col-id {
        width: 56px;
    }

    .tasks-table .task-col-status {
        width: 110px;
    }

    .tasks-table .task-col-client {
        width: 110px;
    }

    .tasks-table .task-col-created {
        width: 140px;
    }

    .tasks-table .task-col-actions {
        width: 200px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 10px;
    }

    /* Allow wide tables to scroll horizontally inside their container instead of pushing the page wider */
    .config-section,
    .clients-table-wrap,
    .tasks-table-wrap,
    .task-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Responsive: Auth split layout ===== */
@media (max-width: 1024px) {
    .auth-brand {
        padding: 48px 40px;
    }

    .brand-headline {
        font-size: 28px;
    }

    .brand-features {
        display: none;
    }
}

@media (max-width: 768px) {
    .auth-layout {
        flex-direction: column;
        min-height: 100vh;
    }

    .auth-brand {
        flex: none;
        min-height: 220px;
        padding: 32px 24px;
        text-align: center;
    }

    .auth-brand-content {
        max-width: 100%;
    }

    .brand-logo {
        justify-content: center;
        margin-bottom: 16px;
    }

    .brand-headline {
        font-size: 22px;
        line-height: 1.4;
        margin-bottom: 8px;
    }

    .brand-sub {
        font-size: 13px;
        margin-bottom: 0;
        margin-left: auto;
        margin-right: auto;
    }

    .auth-panel {
        flex: 1 1 auto;
        padding: 24px 16px 40px;
    }
}

/* ===== Responsive: extra-small screens (small phones) ===== */
@media (max-width: 480px) {
    .auth-brand {
        min-height: 180px;
        padding: 28px 20px;
    }

    .brand-headline {
        font-size: 20px;
    }

    .auth-card {
        padding: 20px;
    }

    .view-header h2 {
        font-size: 18px;
    }

    .modal {
        width: 95vw;
        max-width: 95vw;
        max-height: 90vh;
    }

    /* 移动端下让 .modal-wide 也回到 95vw，避免被 clamp 的 min 值卡住超出视口 */
    .modal.modal-wide {
        width: 95vw;
        max-width: 95vw;
    }

    .btn-primary,
    .btn-secondary,
    .btn-action {
        font-size: 13px;
    }
}

/* Lock background scroll while the off-canvas sidebar is open */
body.sidebar-open {
    overflow: hidden;
}


/* ===== 模型管理（admin） ===== */
/* "+ 新增模型" 按钮风格与资源管理一致：透明背景 + 主题色描边 */
#models-view .commerce-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

#models-view .commerce-add-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--accent-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

#models-view .commerce-add-product-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
}

#models-view .commerce-add-icon {
    font-size: 15px;
    line-height: 1;
    font-weight: 500;
    opacity: 0.9;
}

/* 模型新增/编辑弹窗：与资源弹窗保持一致的卡片 + 表单风格 */
.model-modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.2s ease;
}

.model-modal .commerce-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.model-modal .commerce-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.model-modal .commerce-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.model-modal .commerce-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.model-modal .commerce-form {
    padding: 20px;
}

.model-modal .commerce-form-group {
    margin-bottom: 16px;
}

.model-modal .commerce-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.model-modal .commerce-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-sizing: border-box;
}

.model-modal .commerce-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15);
}

.model-modal .commerce-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

.model-modal .commerce-modal-footer .btn-primary,
.model-modal .commerce-modal-footer .btn-secondary {
    width: auto;
    padding: 8px 20px;
    font-size: 13px;
    white-space: nowrap;
}

.model-modal .resource-hint-text {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.model-modal .required {
    color: var(--accent-danger, #f85149);
    margin-left: 2px;
}

/* ===== AI 推荐开源项目：列表渲染（chat agent reply 内联） ===== */
.oss-rec-table {
    margin-top: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary, #fff);
    font-size: 13px;
}

.oss-rec-row {
    display: grid;
    grid-template-columns: 1.2fr 2fr 2fr 88px 88px;
    gap: 12px;
    padding: 12px 14px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.5;
}

.oss-rec-row:last-child {
    border-bottom: none;
}

.oss-rec-head {
    font-weight: 600;
    background: var(--bg-tertiary, #f7f8fa);
    color: var(--text-primary);
}

.oss-rec-name {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.oss-rec-summary,
.oss-rec-reason {
    color: var(--text-secondary, var(--text-primary));
    word-break: break-word;
}

.oss-rec-reason {
    color: var(--text-tertiary, #6a7280);
}

.oss-rec-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 12px;
}

.oss-rec-link:hover {
    text-decoration: underline;
}

.oss-rec-link-disabled {
    color: var(--text-muted, #9ca3af);
    font-size: 12px;
}

.oss-rec-deploy-btn {
    width: auto;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
    transition: var(--transition, all 0.2s);
}

.oss-rec-deploy-btn:hover:not(:disabled) {
    filter: brightness(0.95);
}

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

.oss-rec-risk {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    background: rgba(248, 81, 73, 0.12);
    color: var(--accent-danger, #f85149);
    border-radius: 4px;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.5;
    word-break: break-word;
}

@media (max-width: 768px) {
    .oss-rec-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .oss-rec-head {
        display: none;
    }
    .oss-rec-name::before { content: '名称：'; color: var(--text-muted); font-weight: normal; }
    .oss-rec-summary::before { content: '简介：'; color: var(--text-muted); }
    .oss-rec-reason::before { content: '推荐理由：'; color: var(--text-muted); }
}

/* ===== Gift tab bar (gifts-view 子 tab) ===== */
.gift-tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 16px;
    padding: 0;
}
.gift-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    border-radius: 0;
}
.gift-tab-btn:hover { color: var(--text-primary); }
.gift-tab-btn.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}
.gift-tab-panel { display: block; }
.gift-tab-panel[hidden] { display: none; }

/* ===== Agent 交互卡片 ===== */
.ui-card-list,
.sc-ui-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.ui-card,
.sc-ui-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary, #fff);
    padding: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.ui-card.is-submitted,
.sc-ui-card.is-submitted {
    border-color: rgba(34, 197, 94, 0.45);
}

.ui-card-title,
.sc-ui-card-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ui-card-desc,
.sc-ui-card-desc {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.ui-card-questions,
.sc-ui-card-questions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ui-card-question {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ui-card-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.ui-card-required {
    color: var(--accent-danger, #f85149);
    margin-left: 2px;
}

.ui-card-help {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.ui-card-danger,
.sc-ui-card-danger {
    color: var(--accent-danger, #f85149);
    font-size: 12px;
    line-height: 1.5;
}

.ui-card-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary);
    font-size: 13px;
}

textarea.ui-card-input {
    min-height: 76px;
    resize: vertical;
}

.ui-card-checks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.ui-card-bool {
    color: var(--text-secondary);
    font-size: 13px;
}

.ui-card-actions,
.sc-ui-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.ui-card-submit,
.sc-ui-card-submit {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background: var(--accent-primary);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.ui-card-submit:disabled,
.sc-ui-card-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== 商品兑换码列表 ===== */
.redeem-codes-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.redeem-codes-hint {
    color: var(--text-muted);
    font-size: 12px;
}
.redeem-codes-table th, .redeem-codes-table td {
    white-space: nowrap;
}

/* 商店按钮组 */
.store-product-actions .store-redeem-btn {
    padding: 6px 14px;
    font-size: 13px;
}

/* ===== 商品兑换码（gifts-view 子 tab）样式 ===== */
/* 复用 #products-view / #orders-view 的 commerce-* 样式，扩展到 #gifts-view */

#gifts-view .commerce-table-wrap {
    overflow-x: auto;
    margin-top: 4px;
}

#gifts-view .commerce-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#gifts-view .commerce-table thead th {
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
}

#gifts-view .commerce-table tbody td {
    padding: 10px 14px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

#gifts-view .commerce-table tbody tr {
    transition: var(--transition);
}

#gifts-view .commerce-table tbody tr:hover {
    background: rgba(88, 166, 255, 0.04);
}

#gifts-view .commerce-table tbody tr:last-child td {
    border-bottom: none;
}

#gifts-view .commerce-code {
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

#gifts-view .commerce-empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 10px !important;
    white-space: normal;
}

#gifts-view .commerce-muted {
    color: var(--text-muted);
    font-size: 12px;
}

#gifts-view .commerce-add-product-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid rgba(88, 166, 255, 0.45);
    box-shadow: none;
    transition: var(--transition);
}

#gifts-view .commerce-add-product-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
}

#gifts-view .commerce-add-icon {
    font-size: 15px;
    line-height: 1;
    font-weight: 500;
    opacity: 0.9;
}

#gifts-view .redeem-codes-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

#gifts-view .redeem-codes-hint {
    color: var(--text-muted);
    font-size: 12px;
}

#gifts-view .commerce-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

#gifts-view .commerce-page-info {
    color: var(--text-muted);
    font-size: 12px;
}

#gifts-view .commerce-offline-btn {
    background: transparent;
    border: 1px solid rgba(248, 81, 73, 0.45);
    color: var(--accent-danger);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

#gifts-view .commerce-offline-btn:hover {
    background: rgba(248, 81, 73, 0.1);
}

/* ========== 业务总览（admin 默认首页） ========== */
#business-overview-view {
    color: var(--text-primary);
}

/* 页头 */
.bo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
}
.bo-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bo-kicker {
    font-size: 11px;
    letter-spacing: 0.22em;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
}
.bo-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #e6edf3 0%, #8b949e 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}
.bo-sub {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.bo-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.bo-window-pill {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(88, 166, 255, 0.25);
    background: rgba(88, 166, 255, 0.08);
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
}
.bo-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.bo-refresh-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.08);
    color: var(--accent-primary);
}
.bo-refresh-btn:active .bo-refresh-icon {
    transform: rotate(-180deg);
}
.bo-refresh-icon {
    display: inline-block;
    transition: transform 0.4s ease;
    font-size: 14px;
}

/* 错误条 */
.bo-error {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--accent-danger);
    font-size: 13px;
}

/* 总览卡片 */
.bo-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.bo-stat-card {
    position: relative;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 22px 22px 20px;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(28, 33, 40, 0.95) 0%, rgba(22, 27, 34, 0.95) 100%);
    border: 1px solid rgba(48, 54, 61, 0.8);
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.bo-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bo-accent, #58a6ff);
    opacity: 0.9;
}
.bo-stat-card::after {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--bo-accent, #58a6ff) 0%, transparent 70%);
    opacity: 0.12;
    pointer-events: none;
}
.bo-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--bo-accent, #58a6ff);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}
.bo-stat-card--users { --bo-accent: #58a6ff; }
.bo-stat-card--clients { --bo-accent: #3fb950; }
.bo-stat-card--chats { --bo-accent: #d29922; }
.bo-stat-card--revenue { --bo-accent: #a371f7; }

.bo-stat-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.bo-stat-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bo-stat-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
}
.bo-stat-hint {
    color: var(--text-muted);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(139, 148, 158, 0.1);
    font-weight: 400;
}
.bo-stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}
.bo-stat-foot {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* 图表面板 */
.bo-chart-panel {
    background: linear-gradient(180deg, rgba(28, 33, 40, 0.85) 0%, rgba(22, 27, 34, 0.9) 100%);
    border: 1px solid rgba(48, 54, 61, 0.8);
    border-radius: 14px;
    padding: 22px 24px 18px;
    margin-bottom: 22px;
}
.bo-chart-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.bo-chart-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}
.bo-chart-sub {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
}
.bo-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.bo-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
}
.bo-legend-chip:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary, #e6edf3);
}
.bo-legend-chip:focus-visible {
    outline: 2px solid rgba(88, 166, 255, 0.6);
    outline-offset: 2px;
}
.bo-legend-chip--hidden {
    opacity: 0.45;
    text-decoration: line-through;
}
.bo-legend-chip--hidden .bo-legend-dot {
    opacity: 0.5;
    box-shadow: none;
}
.bo-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
    transition: opacity 0.15s ease;
}
.bo-chart-wrap {
    position: relative;
    height: 280px;
}
.bo-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}
.bo-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    background: rgba(13, 17, 23, 0.4);
    border-radius: 10px;
}

@media (max-width: 640px) {
    .bo-header { flex-direction: column; align-items: flex-start; }
    .bo-title { font-size: 22px; }
    .bo-stat-value { font-size: 24px; }
    .bo-chart-wrap { height: 220px; }
}
