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

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

#app {
    height: 100%;
}

/* ── Login ──────────────────────────────────────────── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    width: 400px;
    padding: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 64px;
    height: 64px;
    line-height: 64px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 28px;
    font-weight: bold;
}

.login-title {
    font-size: 22px;
    color: #303133;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #909399;
    font-size: 14px;
}

.login-btn {
    width: 100%;
    margin-top: 10px;
}

/* ── App Layout ─────────────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 220px;
    background: #001529;
    transition: width 0.3s;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 48px;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.menu-item.active {
    color: #fff;
    background: #1890ff;
}

.menu-icon {
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar.collapsed .menu-icon {
    margin-right: 0;
}

.menu-text {
    font-size: 14px;
}

/* ── Main Area ──────────────────────────────────────── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 60px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.collapse-btn {
    font-size: 20px;
    cursor: pointer;
    color: #545454;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: #303133;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 14px;
    color: #606266;
}

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

/* ── Dashboard ──────────────────────────────────────── */
.dashboard-page {
    max-width: 1400px;
    margin: 0 auto;
}

.stat-card {
    margin-bottom: 20px;
}

.stat-card-body {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    flex-shrink: 0;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #303133;
}

.stat-label {
    font-size: 13px;
    color: #909399;
    margin-top: 4px;
}

.dashboard-placeholder {
    margin-top: 20px;
}

.welcome-text {
    line-height: 2;
}

.welcome-text ul {
    padding-left: 20px;
}

.text-secondary {
    color: #909399;
    font-size: 13px;
}

.text-pending {
    color: #c0c4cc;
}

/* ── Accounts Page ──────────────────────────────────── */
.accounts-page {
    max-width: 1600px;
    margin: 0 auto;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.upload-area {
    margin: 20px 0;
    padding: 30px;
    border: 2px dashed #dcdfe6;
    border-radius: 8px;
    text-align: center;
}

.upload-label {
    display: inline-block;
    padding: 8px 20px;
    background: #409eff;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.upload-label:hover {
    background: #66b1ff;
}

.file-input {
    margin-bottom: 10px;
}

.upload-tip {
    color: #909399;
    font-size: 13px;
}

.file-name {
    color: #67c23a;
    font-size: 13px;
    margin-top: 8px;
}

.import-dialog-content {
    min-height: 200px;
}

.detail-content {
    padding: 10px;
}

.detail-section {
    margin-top: 20px;
}

.detail-section h4 {
    margin-bottom: 10px;
    color: #303133;
}

/* ── Placeholder ────────────────────────────────────── */
.placeholder-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
}

/* ── Message Center ─────────────────────────────────── */
.message-center-page {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.msg-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 10px;
    height: 100%;
}

.msg-col {
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.msg-col-accounts {
    width: 200px;
    flex-shrink: 0;
}

.msg-col-dialogs {
    width: 300px;
    flex-shrink: 0;
}

.msg-col-detail {
    flex: 1;
    min-width: 0;
}

.msg-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #ebeef5;
    font-weight: 600;
    color: #303133;
    flex-shrink: 0;
}

.msg-search {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f2f5;
    flex-shrink: 0;
}

.msg-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.msg-empty {
    padding: 30px 10px;
    text-align: center;
    color: #909399;
    font-size: 13px;
}

/* 账号项 */
.msg-account-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.msg-account-item:hover {
    background: #f5f7fa;
}

.msg-account-item.active {
    background: #ecf5ff;
    color: #409eff;
}

.msg-account-item.offline {
    opacity: 0.55;
}

.msg-account-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.msg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c0c4cc;
    flex-shrink: 0;
}

.msg-dot.on {
    background: #67c23a;
}

/* 对话项 */
.msg-dialog-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f5f7fa;
}

.msg-dialog-item:hover {
    background: #f5f7fa;
}

.msg-dialog-item.active {
    background: #ecf5ff;
}

.msg-dialog-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.msg-dialog-name {
    font-size: 14px;
    color: #303133;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-dialog-item.active .msg-dialog-name {
    color: #409eff;
}

.msg-badge {
    background: #f56c6c;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    padding: 1px 6px;
    flex-shrink: 0;
}

.msg-dialog-sub {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.msg-dialog-preview {
    font-size: 12px;
    color: #909399;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-dialog-time {
    font-size: 11px;
    color: #c0c4cc;
    flex-shrink: 0;
}

/* 消息详情 */
.msg-detail-header {
    border-bottom: 1px solid #ebeef5;
}

.msg-detail-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-ws-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: normal;
    color: #909399;
}

.msg-detail-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #909399;
}

.msg-detail-list {
    padding: 14px 16px;
}

.msg-load-more {
    text-align: center;
    color: #c0c4cc;
    font-size: 12px;
    padding: 6px 0 12px;
}

.msg-bubble-row {
    display: flex;
    margin-bottom: 10px;
}

.msg-bubble-row.out {
    justify-content: flex-end;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-right: 8px;
    margin-top: 2px;
    background: #e9e9eb;
}

.msg-sender-name {
    font-size: 12px;
    color: #409eff;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-media-img {
    display: block;
    max-width: 240px;
    max-height: 240px;
    border-radius: 8px;
    cursor: zoom-in;
    margin-bottom: 4px;
    object-fit: contain;
    background: #f5f7fa;
}

.msg-bubble {
    max-width: 65%;
    background: #f4f4f5;
    border-radius: 10px;
    padding: 8px 12px;
}

.msg-bubble-row.out .msg-bubble {
    background: #d9ecff;
}

.msg-bubble-text {
    font-size: 14px;
    color: #303133;
    word-break: break-word;
    white-space: pre-wrap;
}

.msg-bubble-time {
    font-size: 11px;
    color: #a8abb2;
    text-align: right;
    margin-top: 3px;
}

.msg-input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 10px 14px;
    border-top: 1px solid #ebeef5;
    flex-shrink: 0;
}
.msg-input-area .el-textarea {
    flex: 1;
}

/* ── 群组管理页 ─────────────────────────────────── */
.groups-page .toolbar-spacer {
    flex: 1;
}

.groups-page .mono {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.groups-page .muted {
    color: #909399;
    font-size: 12px;
}

.groups-page .err-text {
    color: #f56c6c;
    font-size: 12px;
}

.add-results {
    margin-top: 12px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    padding: 8px 12px;
}

.add-results-header {
    font-size: 13px;
    color: #606266;
    margin-bottom: 6px;
}

.add-result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
}

.batch-dialog .batch-select {
    display: flex;
    gap: 16px;
}

.batch-dialog .batch-col {
    flex: 1;
    min-width: 0;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    padding: 10px 12px;
    max-height: 360px;
    overflow-y: auto;
}

.batch-dialog .batch-col-title {
    font-size: 13px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 8px;
}

.batch-dialog .batch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.batch-dialog .batch-row .el-checkbox {
    margin-right: 0;
    height: 28px;
}

.batch-dialog .conn-dot {
    font-size: 12px;
    flex-shrink: 0;
}

.batch-dialog .conn-dot.on {
    color: #67c23a;
}

.batch-dialog .conn-dot.off {
    color: #c0c4cc;
}

.batch-dialog .batch-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    gap: 12px;
}

.task-progress .task-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}

.task-progress .stat.ok {
    color: #67c23a;
}

.task-progress .stat.warn {
    color: #e6a23c;
}

.task-progress .stat.bad {
    color: #f56c6c;
}

.task-progress .task-items {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 10px;
}

.task-progress .task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
    flex-wrap: wrap;
}

.task-progress .task-actions {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.group-detail .detail-info p {
    margin: 6px 0;
    font-size: 13px;
    color: #303133;
}


/* ── 关键词管理页 ───────────────────────────────── */
.keywords-page .kw-section {
    margin-bottom: 20px;
}

.keywords-page .kw-word {
    font-weight: 600;
    color: #303133;
}

.kw-muted {
    color: #909399;
    font-size: 12px;
}

.keywords-page .toolbar-spacer {
    flex: 1;
}

/* ── 监控中心页 ─────────────────────────────────── */
.monitor-page .mon-control {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid #ebeef5;
    border-radius: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.monitor-page .mon-control-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 130px;
}

.monitor-page .mon-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.monitor-page .mon-dot.on {
    background: #67c23a;
    box-shadow: 0 0 6px rgba(103, 194, 58, 0.8);
}

.monitor-page .mon-dot.off {
    background: #c0c4cc;
}

.monitor-page .mon-stats {
    display: flex;
    gap: 18px;
    font-size: 13px;
    color: #606266;
    flex: 1;
}

.monitor-page .mon-stat.ok {
    color: #67c23a;
    font-weight: 600;
}

.monitor-page .mon-section {
    margin-bottom: 20px;
}

.monitor-page .mon-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 10px;
}

.monitor-page .mon-err {
    color: #f56c6c;
    font-size: 12px;
}

.monitor-page .mon-live {
    border: 1px dashed rgba(245, 108, 108, 0.2);
    background: rgba(254, 240, 240, 0.25);
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 10px;
}

.monitor-page .mon-live-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 13px;
    transition: background 0.5s;
}

.monitor-page .mon-live-item.fresh {
    background: #fdf6ec;
}

.monitor-page .mon-live-meta {
    color: #909399;
    flex-shrink: 0;
}

.monitor-page .mon-live-text {
    color: #303133;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.monitor-page .mon-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

/* ── 私信记录页 ─────────────────────────────────── */
.messages-page .pm-top {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.messages-page .pm-stats-row {
    display: flex;
    gap: 10px;
    flex: 1;
    flex-wrap: wrap;
}

.messages-page .pm-stat-card {
    min-width: 96px;
    padding: 10px 14px;
    border: 1px solid #ebeef5;
    border-radius: 6px;
    text-align: center;
    background: #fafbfc;
}

.messages-page .pm-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #303133;
}

.messages-page .pm-stat-value.ok {
    color: #67c23a;
}

.messages-page .pm-stat-value.bad {
    color: #f56c6c;
}

.messages-page .pm-stat-value.warn {
    color: #e6a23c;
}

.messages-page .pm-stat-label {
    font-size: 12px;
    color: #909399;
    margin-top: 2px;
}

.messages-page .pm-switch-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid #ebeef5;
    border-radius: 6px;
    background: #fdf6ec;
}

.messages-page .pm-switch-label {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #303133;
}

.messages-page .pm-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── 仪表盘（阶段5 重写） ────────────────────────── */
.dashboard-page .dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

@media (max-width: 992px) {
    .dashboard-page .dash-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-page .dash-panel .el-card__header {
    padding: 10px 16px;
}

.dashboard-page .dash-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.dashboard-page .dash-hit-item,
.dashboard-page .dash-pm-item,
.dashboard-page .dash-log-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px dashed #f0f2f5;
}

.dashboard-page .dash-hit-item:last-child,
.dashboard-page .dash-pm-item:last-child,
.dashboard-page .dash-log-item:last-child {
    border-bottom: none;
}

.dashboard-page .dash-hit-item.fresh {
    background: #fdf6ec;
}

.dashboard-page .dash-hit-meta {
    color: #909399;
    flex-shrink: 0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-page .dash-hit-text {
    color: #303133;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-page .dash-log-text {
    color: #303133;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-page .dash-time {
    color: #c0c4cc;
    font-size: 12px;
    flex-shrink: 0;
}

.mon-dot-inline {
    font-size: 12px;
}

.mon-dot-inline.ok {
    color: #67c23a;
}

.mon-dot-inline.bad {
    color: #f56c6c;
}

.mon-dot-inline.muted-c {
    color: #c0c4cc;
}

/* ── 系统设置页（阶段5） ─────────────────────────── */
.settings-page .set-card {
    margin-bottom: 16px;
}

.settings-page .set-group {
    margin-bottom: 10px;
}

.settings-page .set-group-title {
    font-size: 13px;
    font-weight: 600;
    color: #409eff;
    margin-bottom: 6px;
    border-left: 3px solid #409eff;
    padding-left: 8px;
}

.settings-page .set-label {
    font-size: 13px;
    color: #303133;
}

.settings-page .set-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-page .set-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 992px) {
    .settings-page .set-two-col {
        grid-template-columns: 1fr;
    }
}

.settings-page .set-sysinfo p {
    margin: 8px 0;
    font-size: 13px;
    color: #303133;
}

.settings-page .set-sysinfo .mono {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.settings-page .set-clean-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.settings-page .set-clean-label {
    font-size: 13px;
    color: #303133;
}
