/* ═══════════════════════════════════════════════
   SmartPupil AI Grid — Claude 暖色调 UI v2
   参考 Claude 官网配色：暖米色 + 赤陶橙 + 奶油白
   ═══════════════════════════════════════════════ */

:root {
    /* ── Claude 暖色板 ── */
    --bg-page: #f9f5ef;
    /* 暖米色页面底色 */
    --bg-card: #ffffff;
    /* 奶油白卡片 */
    --bg-sidebar: #faf6f0;
    /* 侧边栏暖底 */
    --bg-hover: #f3ece2;
    /* 悬浮态 */
    --bg-tertiary: #f5f0e8;
    /* 第三层暖灰 */
    --bg-input: #fdfaf5;
    /* 输入框底 */

    --text-primary: #2d2a26;
    /* 暖黑 */
    --text-secondary: #6b6560;
    /* 暖灰 */
    --text-tertiary: #a39e96;
    /* 淡暖灰 */
    --text-muted: #c4beb5;
    /* 更淡 */

    --border-color: #e8e0d4;
    /* 暖色边框 */
    --border-light: #f0e9de;
    /* 更淡边框 */
    --border-focus: #c96442;
    /* 聚焦态 */

    /* ── 强调色（赤陶系） ── */
    --accent: #c96442;
    /* 赤陶橙 */
    --accent-soft: #d4845e;
    /* 柔赤陶 */
    --accent-hover: #b85a3a;
    /* 深赤陶 */
    --accent-bg: #fdf2ec;
    /* 赤陶背景 */
    --accent-bg-deep: #f9e4d8;
    /* 深赤陶背景 */
    --accent-text: #9c4a2e;
    /* 赤陶文字 */

    /* ── 语义色 ── */
    --green: #3d9970;
    --green-bg: #eef7f2;
    --green-soft: #b5dcc5;
    --red: #c44e4e;
    --red-bg: #fef0f0;
    --yellow: #c99b42;
    --yellow-bg: #fdf6e8;
    --blue: #5f8dbd;
    --blue-bg: #edf3f9;

    /* ── 阴影 ── */
    --shadow-xs: 0 1px 2px rgba(45, 42, 38, 0.03);
    --shadow-sm: 0 1px 3px rgba(45, 42, 38, 0.05), 0 1px 2px rgba(45, 42, 38, 0.03);
    --shadow-md: 0 4px 12px rgba(45, 42, 38, 0.06), 0 1px 3px rgba(45, 42, 38, 0.04);
    --shadow-lg: 0 8px 24px rgba(45, 42, 38, 0.08), 0 2px 6px rgba(45, 42, 38, 0.04);

    /* ── 圆角 ── */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* ── 布局 ── */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sidebar-width: 228px;
    --mobile-header-h: 52px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ═══ Lucide 图标尺寸 ═══ */
.icon {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.icon-xs {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.icon-sm {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
}

.icon-nav {
    width: 18px;
    height: 18px;
    stroke-width: 1.6;
    flex-shrink: 0;
}

.icon-brand {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    color: var(--accent);
}

.icon-stat {
    width: 20px;
    height: 20px;
    stroke-width: 1.6;
    color: var(--accent-soft);
}

.icon-card-title {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
    color: var(--text-tertiary);
    vertical-align: -2px;
    margin-right: 6px;
}

/* ═══ Layout ═══ */
#app {
    display: flex;
    min-height: 100vh;
}

/* ═══ Mobile Header ═══ */
#mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    padding: 6px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.mobile-menu-btn:active {
    background: var(--bg-hover);
}

.mobile-brand {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* ═══ Sidebar ═══ */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-light);
}

.brand-logo {
    width: 34px;
    height: 34px;
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text {
    font-size: 16px;
    font-weight: 650;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 450;
    transition: all var(--transition);
    user-select: none;
}

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

.nav-item.active {
    background: var(--accent-bg);
    color: var(--accent-text);
    font-weight: 550;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border-light);
}

.runtime-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px rgba(61, 153, 112, 0.4);
    animation: pulse 2.5s infinite;
}

.status-dot.offline {
    background: var(--red);
    box-shadow: 0 0 6px rgba(196, 78, 78, 0.4);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.55;
        transform: scale(0.85);
    }
}

/* 侧边栏遮罩（移动端） */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45, 42, 38, 0.35);
    backdrop-filter: blur(2px);
    z-index: 140;
}

/* ═══ Main Content ═══ */
#main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 36px 40px;
    max-width: 1200px;
}

.page {
    display: none;
    animation: fadeIn 0.25s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.page-header h1 {
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

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

/* ═══ Stats Grid ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card.accent {
    border-color: var(--accent-bg-deep);
    background: linear-gradient(135deg, var(--accent-bg) 0%, #fff 100%);
}

.stat-icon {
    width: 38px;
    height: 38px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card.accent .stat-icon {
    background: var(--accent-bg-deep);
}

.stat-body {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 550;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--text-primary);
}

.stat-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 3px;
}

/* ═══ Content Grid ═══ */
.content-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* ═══ Card ═══ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-tertiary);
}

.card-header h3 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.1px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.card-body {
    padding: 16px 18px;
}

/* ═══ Table ═══ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.data-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-tertiary);
    font-weight: 550;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    background: var(--bg-input);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

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

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

/* ═══ Buttons ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-xs);
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

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

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-danger {
    color: var(--red);
    border-color: var(--red);
}

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

/* ═══ Form Controls ═══ */
.select-control,
.input-control {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.select-control:focus,
.input-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(201, 100, 66, 0.1);
}

.input-control {
    width: 100%;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 550;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ═══ Tags Input ═══ */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: var(--accent-bg);
    border: 1px solid var(--accent-bg-deep);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-text);
}

.tag-remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 14px;
    line-height: 1;
    transition: opacity var(--transition);
}

.tag-remove:hover {
    opacity: 1;
}

.tag-input-row {
    display: flex;
    gap: 8px;
}

.tag-input-row .input-control {
    flex: 1;
}

.selection-preview {
    margin-top: 14px;
    border-top: 1px solid var(--border-light);
    padding-top: 14px;
}

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

.selection-preview-title {
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.selection-summary {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.selection-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.selection-chip-score {
    font-size: 11px;
    color: var(--text-tertiary);
}

.selection-muted {
    opacity: 0.65;
}

/* ═══ Settings Layout ═══ */
.settings-section {
    margin-bottom: 16px;
}

.settings-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}

.settings-two-col .card {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 14px;
}

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

.settings-grid .full-width {
    grid-column: 1 / -1;
}

/* ═══ AI Sessions ═══ */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.session-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.session-card:hover {
    box-shadow: var(--shadow-md);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.session-header:hover {
    background: var(--bg-hover);
}

.session-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.session-round {
    font-weight: 650;
    font-size: 14px;
    color: var(--text-primary);
}

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

.session-body {
    padding: 14px 16px;
    display: none;
    border-top: 1px solid var(--border-light);
}

.session-body.open {
    display: block;
}

.session-assessment {
    padding: 10px 14px;
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--accent-text);
    border-left: 3px solid var(--accent);
}

.suggestion-group {
    margin-bottom: 12px;
}

.suggestion-group h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    font-weight: 550;
}

.suggestion-item {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 13px;
    border-left: 2px solid var(--border-color);
}

/* ═══ Scrollable List ═══ */
.scrollable-list {
    max-height: 280px;
    overflow-y: auto;
}

.pair-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.pair-item:last-child {
    border-bottom: none;
}

.pair-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pair-symbol {
    font-weight: 600;
    font-size: 13px;
}

.pair-detail {
    font-size: 11px;
    color: var(--text-tertiary);
}

.mobile-order-extra {
    display: none;
}

.pair-status {
    text-align: right;
}

/* ═══ Badges ═══ */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 550;
    letter-spacing: 0.2px;
}

.badge-pending {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.badge-filled {
    background: var(--green-bg);
    color: var(--green);
}

.badge-cancelled {
    background: var(--red-bg);
    color: var(--red);
}

.badge-buy {
    background: var(--green-bg);
    color: var(--green);
}

.badge-sell {
    background: var(--red-bg);
    color: var(--red);
}

.badge-waiting {
    background: var(--blue-bg);
    color: var(--blue);
}

/* ═══ Reason Popover ═══ */
.reason-trigger {
    cursor: pointer;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 2px;
}

.reason-trigger:hover {
    opacity: 0.85;
}

.reason-popover {
    display: none;
    position: fixed;
    z-index: 400;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 14px 16px;
    max-width: 360px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    animation: modalIn 0.15s ease;
}

.reason-popover.open {
    display: block;
}

.reason-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reason-popover-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
}

/* ═══ Confidence Badges ═══ */
.badge-confidence {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-high {
    background: var(--green-bg);
    color: var(--green);
}

.badge-medium {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.badge-low {
    background: var(--red-bg);
    color: var(--red);
}

.badge-completed {
    background: var(--green-bg);
    color: var(--green);
}

.profit-positive {
    color: var(--green);
    font-weight: 650;
}

.profit-negative {
    color: var(--red);
    font-weight: 650;
}

/* ═══ Chart ═══ */
#profit-chart {
    width: 100% !important;
}

/* ═══ Empty State ═══ */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ═══ Modal ═══ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45, 42, 38, 0.4);
    backdrop-filter: blur(3px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 420px;
    max-width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

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

.modal-body {
    padding: 20px 22px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
}

/* ═══ Toast Notifications ═══ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease forwards;
    animation-delay: 0s, var(--toast-duration, 3s);
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-success {
    border-left: 3px solid var(--green);
}

.toast-error {
    border-left: 3px solid var(--red);
}

.toast-info {
    border-left: 3px solid var(--accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* ═══ Account Action Buttons ═══ */
.account-actions {
    display: flex;
    gap: 6px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-action-start {
    background: var(--green-bg);
    color: var(--green);
}

.btn-action-start:hover {
    background: var(--green-soft);
}

.btn-action-stop {
    background: var(--red-bg);
    color: var(--red);
}

.btn-action-stop:hover {
    background: #f9d4d4;
}

.btn-action-test {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-action-test:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-action-sync {
    background: var(--blue-bg);
    color: var(--blue);
}

.btn-action-sync:hover {
    background: #dce9f7;
}

/* ═══ Login Page ═══ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--bg-page) 0%, var(--accent-bg) 50%, var(--bg-page) 100%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    width: 370px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    text-align: center;
    font-size: 20px;
    font-weight: 650;
    margin-bottom: 4px;
    letter-spacing: -0.4px;
}

.login-card .form-group {
    margin-bottom: 18px;
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 11px;
}

/* ═══ 移动端适配 ═══ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {

    /* 显示移动端顶栏 */
    #mobile-header {
        display: flex;
    }

    /* 隐藏桌面端元素 */
    .desktop-only {
        display: none !important;
    }

    /* 侧边栏默认隐藏，左滑出 */
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #sidebar-overlay.open {
        display: block;
    }

    /* 主内容区 */
    #main-content {
        margin-left: 0;
        padding: 14px;
        padding-top: calc(var(--mobile-header-h) + 14px);
    }

    /* 页面标题 */
    .page-header h1 {
        font-size: 18px;
    }

    .page-header {
        margin-bottom: 16px;
    }

    /* 统计卡片：2 列 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 12px;
        gap: 8px;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
    }

    .stat-icon .icon-stat {
        width: 16px;
        height: 16px;
    }

    .stat-value {
        font-size: 17px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-sub {
        font-size: 10px;
    }

    /* 内容网格单列 */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* 设置页单列 */
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-two-col {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* 卡片 */
    .card {
        margin-bottom: 12px;
        border-radius: var(--radius-sm);
    }

    .card-header {
        padding: 10px 14px;
    }

    .card-body {
        padding: 12px 14px;
    }

    /* 表格 */
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .hide-mobile {
        display: none !important;
    }

    .mobile-order-extra {
        display: block;
    }

    /* AI 会话 */
    .session-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .session-body {
        padding: 10px 12px;
    }

    /* 标题 actions */
    .header-actions {
        width: 100%;
    }

    .header-actions .select-control {
        flex: 1;
        min-width: 0;
    }

    /* 上下滚动优化 */
    .scrollable-list {
        max-height: 200px;
    }
}

@media (max-width: 420px) {

    /* 极小屏幕 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
        gap: 6px;
    }

    .stat-icon {
        display: none;
    }

    .stat-value {
        font-size: 16px;
    }

    #main-content {
        padding: 10px;
        padding-top: calc(var(--mobile-header-h) + 10px);
    }

    .page-header h1 {
        font-size: 16px;
    }

    .badge {
        font-size: 10px;
        padding: 2px 7px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* ═══ 安全区域（iOS 刘海屏） ═══ */
@supports (padding-top: env(safe-area-inset-top)) {
    #mobile-header {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--mobile-header-h) + env(safe-area-inset-top));
    }

    #main-content {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}
/* ═══ Notification Settings ═══ */
.notify-groups {
    display: grid;
    gap: 14px;
    margin-top: 8px;
}

.notify-group {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    overflow: hidden;
}

.notify-group-title {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.2px;
}

.notify-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.notify-option + .notify-option {
    border-top: 1px solid var(--border-light);
}

.notify-option:hover {
    background: var(--bg-hover);
}

.notify-option input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.notify-option-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.notify-option-desc {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: 2px;
}
