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

:root {
    --primary: #000000;
    --primary-hover: #333333;
    --primary-light: #f5f5f5;
    --bg-body: #fafafa;
    --bg-card: #ffffff;
    --bg-navbar: #ffffff;
    --text-primary: #000000;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --shadow: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.06);
    --radius: 2px;
    --radius-lg: 4px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-body);
    min-height: 100vh;
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* Navbar */
.navbar {
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: none;
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    height: 64px;
}

.navbar-brand {
    margin-right: 48px;
}

.brand-link {
    text-decoration: none;
}

.brand-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.brand-highlight {
    color: var(--text-secondary);
    font-weight: 400;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
}

.navbar-menu .menu-item {
    position: relative;
}

.navbar-menu .menu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    border-radius: 0;
    transition: color 0.15s;
    white-space: nowrap;
}

.navbar-menu .menu-link:hover {
    color: var(--text-primary);
    background: transparent;
}

.navbar-menu .menu-item.active .menu-link,
.navbar-menu .menu-link.active {
    color: var(--text-primary);
    background: transparent;
    border-bottom: 2px solid var(--text-primary);
}

.menu-icon {
    font-size: 0.875rem;
    opacity: 0.6;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 24px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

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

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px 40px;
}

/* Tool Page */
.tool-page {
    background: var(--bg-card);
    border-radius: 0;
    border: 1px solid var(--border);
    box-shadow: none;
    padding: 48px;
}

.page-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.page-icon {
    font-size: 2rem;
    opacity: 0.4;
    filter: grayscale(100%);
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.page-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Input-Output Layout */
.input-output {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin-bottom: 32px;
    background: var(--border);
    border: 1px solid var(--border);
}

.io-panel {
    border: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-actions {
    display: flex;
    gap: 16px;
}

.btn-sm {
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-sm:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.io-panel textarea,
.tool-form textarea {
    width: 100%;
    flex: 1;
    padding: 20px;
    border: none;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.8;
    resize: vertical;
    min-height: 300px;
    color: var(--text-primary);
}

.io-panel textarea:focus,
.tool-form textarea:focus {
    outline: none;
}

.output-panel .result {
    flex: 1;
    min-height: 300px;
    padding: 20px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
}

/* Tool Options */
.tool-options {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

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

.option-group label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.option-group select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    font-size: 0.8125rem;
    background: var(--bg-card);
    cursor: pointer;
    color: var(--text-primary);
}

.option-group select:focus {
    outline: none;
    border-color: var(--text-primary);
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 1px;
    margin-bottom: 32px;
    background: var(--border);
    border: 1px solid var(--border);
}

.mode-btn {
    padding: 12px 24px;
    border: none;
    background: var(--bg-card);
    border-radius: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    flex: 1;
}

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

.mode-btn.active {
    background: var(--text-primary);
    color: var(--bg-card);
}

.timestamp-input {
    margin-bottom: 32px;
}

.timestamp-input input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.timestamp-input input:focus {
    outline: none;
    border-color: var(--text-primary);
}

/* Result Display */
.result-display {
    margin-bottom: 32px;
}

.result-display .result {
    padding: 24px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 0;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 100px;
    color: var(--text-primary);
}

.result-display .result:empty::before {
    content: '结果将在此处显示...';
    color: var(--text-muted);
}

/* Color Input */
.color-input-area {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
}

.color-preview-large {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.color-inputs {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: center;
}

.color-inputs input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

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

/* Coord Inputs */
.coord-inputs {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.coord-group {
    flex: 1;
    min-width: 200px;
}

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

.coord-row {
    display: flex;
    gap: 10px;
}

.coord-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
}

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

.coord-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    padding-top: 36px;
}

/* Password Options */
.password-options {
    margin-bottom: 24px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.option-row label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 80px;
}

.option-row input[type="number"] {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.checkbox-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Button */
.btn-primary {
    background: var(--text-primary);
    color: var(--bg-card);
    border: 1px solid var(--text-primary);
    padding: 14px 32px;
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary:hover {
    background: transparent;
    color: var(--text-primary);
    transform: none;
}

.tool-form .btn-primary {
    display: block;
    width: 100%;
}

/* Result */
.result {
    margin-top: 0;
}

.result.show {
    display: block;
}

.result.error {
    background: #fafafa;
    color: #000000;
    border-color: var(--border);
}

.result.success {
    background: #fafafa;
    color: #000000;
    border-color: var(--border);
}

/* QR Result */
.qr-image {
    display: block;
    margin: 0 auto;
    max-width: 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.qr-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 0.875rem;
    color: var(--primary);
    word-break: break-all;
}

/* Visitor Audit */
.visitor-audit {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.visitor-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
}

.visitor-summary-item {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-body) 100%);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 102px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.visitor-summary-item .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.visitor-summary-item strong {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.visitor-summary-item .hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.visitor-audit-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.visitor-toolbar-copy {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.visitor-toolbar-label {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.visitor-toolbar-status {
    color: var(--text-secondary);
}

.visitor-refresh-btn {
    flex-shrink: 0;
}

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

.visitor-log-card {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.visitor-log-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 0, 0, 0.12);
}

.visitor-log-card--page {
    border-left: 4px solid #2563eb;
}

.visitor-log-card--tool {
    border-left: 4px solid #7c3aed;
}

.visitor-log-card--api {
    border-left: 4px solid #0f766e;
}

.visitor-log-card--other {
    border-left: 4px solid #6b7280;
}

.visitor-log-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.visitor-log-card-main {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.visitor-log-title-group {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.visitor-log-target {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.visitor-log-path {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.visitor-log-card-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.visitor-badge,
.visitor-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.visitor-badge-event {
    background: var(--primary-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.visitor-badge-page {
    background: #dbeafe;
    color: #1d4ed8;
}

.visitor-badge-tool {
    background: #ede9fe;
    color: #6d28d9;
}

.visitor-badge-api {
    background: #ccfbf1;
    color: #0f766e;
}

.visitor-badge-other {
    background: #f3f4f6;
    color: #4b5563;
}

.visitor-badge-source {
    background: var(--bg-body);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.visitor-status-badge-success {
    background: #dcfce7;
    color: #166534;
}

.visitor-status-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.visitor-status-badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.visitor-status-badge-neutral {
    background: var(--bg-body);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.visitor-log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.visitor-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.visitor-meta-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.visitor-meta-value {
    color: var(--text-primary);
    font-weight: 500;
}

.visitor-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--bg-card);
}

.visitor-audit-table {
    border: 1px solid var(--border);
    overflow-x: auto;
    background: var(--bg-card);
}

.visitor-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 960px;
}

.visitor-table th,
.visitor-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    font-size: 0.8125rem;
    vertical-align: top;
}

.visitor-table th {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-body);
}

.visitor-table tbody tr:hover {
    background: var(--primary-light);
}

.visitor-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Diff Wrapper */
.diff-wrapper {
    background: #ffffff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.diff-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #e5e7eb;
}

.diff-panel {
    background: #ffffff;
}

.diff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8125rem;
    color: #6b7280;
    font-weight: 500;
}

.diff-editor {
    position: relative;
    background: #ffffff;
    height: 400px;
}

.diff-textarea {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 12px 12px 12px 55px;
    border: none;
    background: transparent;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 22px;
    color: #1f2937;
    caret-color: #1f2937;
    resize: none;
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    z-index: 2;
    box-sizing: border-box;
}

.diff-textarea::placeholder {
    color: #9ca3af;
}

.diff-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 12px 12px 12px 0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 22px;
    white-space: pre-wrap;
    word-wrap: break-word;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
    box-sizing: border-box;
    color: transparent;
}

.diff-line {
    min-height: 22px;
}

.diff-linenum {
    display: inline-block;
    width: 40px;
    color: #9ca3af;
    text-align: right;
    padding-right: 10px;
    margin-right: 8px;
    border-right: 1px solid #e5e7eb;
    user-select: none;
    flex-shrink: 0;
}

.diff-line.deleted {
    background: #fee2e2;
}

.diff-line.deleted .diff-linenum {
    color: #dc2626;
}

.diff-line.added {
    background: #d1fae5;
}

.diff-line.added .diff-linenum {
    color: #059669;
}

.diff-stats {
    display: flex;
    gap: 20px;
    padding: 12px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 0.8125rem;
    color: #6b7280;
}

.diff-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.diff-stats .stat-item.same {
    color: #059669;
}

.diff-stats .stat-item.added {
    color: #059669;
}

.diff-stats .stat-item.deleted {
     color: #dc2626;
 }

 .diff-stats .stat-item.changed {
     color: #ea580c;
 }

 .diff-line.changed {
     background: #fef3c7;
 }

 .diff-line.changed .diff-linenum {
     color: #d97706;
 }

 .diff-prefix {
     user-select: none;
     font-weight: bold;
 }

 /* Character-level diff styles in editor */
 /* 字符级差异高亮 - 采用颜色标记方案 */
 .char-added {
     background: #d1fae5;
     color: #059669;
     font-weight: bold;
     padding: 1px 3px;
     border-radius: 2px;
     box-shadow: inset 0 0 0 1px #a7d8b8;
 }

 .char-deleted {
     background: #fee2e2;
     color: #dc2626;
     text-decoration: underline wavy #dc2626;
     font-weight: bold;
     padding: 1px 3px;
     border-radius: 2px;
     box-shadow: inset 0 0 0 1px #f0b8b8;
 }

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 900px) {
    .input-output {
        grid-template-columns: 1fr;
    }

    .visitor-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .visitor-audit-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .visitor-log-card-head {
        flex-direction: column;
    }

    .visitor-log-card-badges {
        justify-content: flex-start;
    }

    .visitor-log-meta {
        gap: 8px;
    }
    
    .navbar-menu {
        display: none;
    }
    
    .coord-inputs {
        flex-direction: column;
    }
    
    .coord-arrow {
        text-align: center;
        padding: 8px 0;
    }
    
    .color-input-area {
        flex-direction: column;
        align-items: stretch;
    }
    
    .color-preview-large {
        width: 100%;
        height: 80px;
    }
    
    .checkbox-row {
        flex-direction: column;
        gap: 12px;
    }
}

/* Dark Theme */
body.dark-theme {
    --bg-body: #0a0a0a;
    --bg-card: #000000;
    --bg-navbar: #000000;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-muted: #666666;
    --border: #1a1a1a;
    --border-light: #0f0f0f;
    --primary-light: #1a1a1a;
}

body.dark-theme .navbar {
    border-bottom-color: var(--border);
}

body.dark-theme .tool-page {
    border-color: var(--border);
}

body.dark-theme .page-header {
    border-bottom-color: var(--border);
}

body.dark-theme .panel-header {
    background: var(--bg-card);
}

body.dark-theme .io-panel textarea,
body.dark-theme .tool-form textarea,
body.dark-theme .timestamp-input input,
body.dark-theme .coord-row input,
body.dark-theme .color-inputs input,
body.dark-theme .option-group select,
body.dark-theme .option-row input {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

body.dark-theme .result-display .result,
body.dark-theme .output-panel .result {
    background: var(--bg-body);
}

body.dark-theme .footer {
    border-top-color: var(--border);
}

body.dark-theme .mode-btn.active {
    background: var(--text-primary);
    color: var(--bg-card);
}

body.dark-theme .btn-primary:hover {
    background: transparent;
    color: var(--text-primary);
}

body.dark-theme .visitor-summary-item {
    background: linear-gradient(180deg, #111111 0%, #0a0a0a 100%);
    box-shadow: none;
}

body.dark-theme .visitor-summary-item-total {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
}

body.dark-theme .visitor-audit-toolbar,
body.dark-theme .visitor-log-card,
body.dark-theme .visitor-empty {
    box-shadow: none;
}

body.dark-theme .visitor-log-card:hover {
    border-color: var(--border);
}

body.dark-theme .visitor-badge-event,
body.dark-theme .visitor-badge-source,
body.dark-theme .visitor-status-badge-neutral,
body.dark-theme .visitor-meta-chip {
    background: var(--bg-body);
    border-color: var(--border);
}

body.dark-theme .visitor-badge-page {
    background: rgba(37, 99, 235, 0.18);
    color: #93c5fd;
}

body.dark-theme .visitor-badge-tool {
    background: rgba(124, 58, 237, 0.18);
    color: #c4b5fd;
}

body.dark-theme .visitor-badge-api {
    background: rgba(15, 118, 110, 0.18);
    color: #5eead4;
}

body.dark-theme .visitor-badge-other {
    background: rgba(107, 114, 128, 0.18);
    color: #d1d5db;
}

body.dark-theme .visitor-status-badge-success {
    background: rgba(22, 101, 52, 0.35);
    color: #bbf7d0;
}

body.dark-theme .visitor-status-badge-warning {
    background: rgba(146, 64, 14, 0.35);
    color: #fde68a;
}

body.dark-theme .visitor-status-badge-danger {
    background: rgba(185, 28, 28, 0.35);
    color: #fecaca;
}

/* ==============================
   小红书舆情搜索 - XHS Module
   ============================== */

/* 搜索栏 */
.xhs-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.xhs-search-input-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.xhs-search-icon {
    position: absolute;
    left: 12px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0.5;
}

.xhs-search-input {
    width: 100%;
    padding: 11px 16px 11px 36px;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.xhs-search-input:focus {
    outline: none;
    border-color: #ff2442;
    box-shadow: 0 0 0 3px rgba(255,36,66,0.08);
}

.xhs-sort-wrap {
    display: flex;
    gap: 4px;
    background: var(--bg-body);
    border-radius: 20px;
    padding: 3px;
    border: 1px solid var(--border);
}

.xhs-sort-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.18s;
    white-space: nowrap;
}

.xhs-sort-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.xhs-sort-btn.active {
    background: #ff2442;
    color: #fff;
    font-weight: 600;
}

.xhs-search-submit {
    padding: 10px 22px;
    background: #ff2442;
    color: #fff;
    border: none;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
    white-space: nowrap;
}

.xhs-search-submit:hover { background: #e01f38; }
.xhs-search-submit:active { transform: scale(0.97); }
.xhs-search-submit:disabled { background: #ccc; cursor: not-allowed; }

/* 统计栏 */
.xhs-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 8px;
}

.xhs-stats-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.xhs-stats-keyword {
    font-weight: 600;
    color: var(--text-primary);
}

.xhs-stats-count strong {
    color: #ff2442;
    font-weight: 700;
}

.xhs-stats-dur {
    color: var(--text-secondary);
}

.xhs-stats-sort-label {
    font-size: 12px;
    padding: 3px 10px;
    background: rgba(255,36,66,0.08);
    color: #ff2442;
    border-radius: 12px;
}

/* 加载中 */
.xhs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.xhs-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: #ff2442;
    border-radius: 50%;
    animation: xhs-spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* 错误 */
.xhs-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: rgba(220,38,38,0.06);
    border: 1px solid rgba(220,38,38,0.2);
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
    margin-bottom: 12px;
}

/* 空结果 */
.xhs-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.xhs-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.xhs-empty p {
    margin: 4px 0;
    font-size: 15px;
}

.xhs-empty-hint {
    font-size: 13px !important;
    opacity: 0.6;
}

/* 结果列表 */
.xhs-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 帖子卡片 */
.xhs-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

.xhs-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-color: rgba(255,36,66,0.25);
    transform: translateY(-1px);
}

/* 卡片顶部：用户 + 时间 */
.xhs-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.xhs-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.xhs-avatar-wrap {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
}

.xhs-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.xhs-avatar-fallback {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff2442, #ff6b81);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.xhs-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.xhs-nickname {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.xhs-location {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.xhs-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* 标题 */
.xhs-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.45;
}

/* 正文 */
.xhs-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0 0 10px 0;
    white-space: pre-line;
}

.xhs-desc-more {
    color: #ff2442;
    cursor: pointer;
    font-size: 13px;
}

.xhs-desc-more:hover { text-decoration: underline; }

/* 图片 */
.xhs-imgs {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
}

.xhs-img-single .xhs-img {
    max-width: 340px;
    max-height: 240px;
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.xhs-img-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.xhs-img-two .xhs-img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 6px;
}

.xhs-img-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.xhs-img-grid .xhs-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
}

.xhs-img {
    cursor: zoom-in;
    transition: opacity 0.15s;
}

.xhs-img:hover { opacity: 0.88; }

/* 标签 */
.xhs-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.xhs-tag {
    padding: 3px 10px;
    background: rgba(255,36,66,0.07);
    color: #ff2442;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.xhs-tag:hover {
    background: rgba(255,36,66,0.15);
}

/* 互动数据 */
.xhs-stats {
    display: flex;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
    flex-wrap: wrap;
}

.xhs-stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.xhs-stat-icon { font-size: 14px; }

.xhs-stat-num {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 22px;
}

/* 暗色主题 */
body.dark-theme .xhs-search-input {
    background: var(--bg-body);
    border-color: var(--border);
    color: var(--text-primary);
}

body.dark-theme .xhs-search-input:focus {
    border-color: #ff2442;
    box-shadow: 0 0 0 3px rgba(255,36,66,0.12);
}

body.dark-theme .xhs-sort-wrap {
    background: var(--bg-card);
}

body.dark-theme .xhs-sort-btn:hover {
    background: var(--bg-body);
}

body.dark-theme .xhs-card {
    background: var(--bg-card);
}

body.dark-theme .xhs-stats {
    border-color: var(--border);
}

body.dark-theme .xhs-tag {
    background: rgba(255,36,66,0.12);
}

body.dark-theme .xhs-stats-bar {
    background: var(--bg-card);
    border-color: var(--border);
}

/* 响应式 */
@media (max-width: 640px) {
    .xhs-search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .xhs-search-input-wrap { min-width: unset; }

    .xhs-sort-wrap {
        width: 100%;
        justify-content: center;
    }

    .xhs-search-submit { width: 100%; text-align: center; }

    .xhs-img-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .xhs-stats {
        gap: 14px;
    }

    .xhs-nickname { max-width: 110px; }
}

/* (旧版 sentinel styles 保留兼容) */
.sentiment-form { max-width: 1000px; }

.sentiment-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sentiment-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

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

.sentiment-sort-select {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 140px;
}

.sentiment-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sentiment-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sentiment-stat-item .stat-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.sentiment-stat-item strong {
    font-size: 16px;
    color: var(--text-primary);
}

.sentiment-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.sentiment-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sentiment-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.sentiment-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border-color: var(--primary);
}

.sentiment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.sentiment-card-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.sentiment-card-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sentiment-card-user-info {
    display: flex;
    flex-direction: column;
}

.sentiment-card-nickname {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.sentiment-card-ip {
    font-size: 12px;
    color: var(--text-secondary);
}

.sentiment-card-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.sentiment-card-content {
    margin-bottom: 12px;
}

.sentiment-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.sentiment-card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sentiment-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.sentiment-tag {
    padding: 2px 8px;
    background: var(--bg-body);
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary);
}

.sentiment-card-images {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sentiment-card-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.sentiment-card-img:hover {
    transform: scale(1.05);
}

.sentiment-card-stats {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.sentiment-stat {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.sentiment-empty,
.sentiment-error {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sentiment-error {
    color: #dc2626;
}

body.dark-theme .sentiment-card {
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
}

body.dark-theme .sentiment-input,
body.dark-theme .sentiment-sort-select {
    background: var(--bg-body);
    border-color: var(--border);
    color: var(--text-primary);
}

body.dark-theme .sentiment-input:focus {
    border-color: var(--primary);
}

body.dark-theme .sentiment-stat {
    color: var(--text-secondary);
}

body.dark-theme .sentiment-tag {
    background: var(--bg-body);
}

body.dark-theme .sentiment-card-stats {
    border-color: var(--border);
}

@media (max-width: 600px) {
    .sentiment-search-bar {
        flex-direction: column;
    }
    
    .sentiment-input,
    .sentiment-sort-select {
        width: 100%;
    }
    
    .sentiment-card-images {
        justify-content: center;
    }
    
    .sentiment-card-img {
        width: 80px;
        height: 80px;
    }
}
