:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.brand-text {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: block;
    padding: 12px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: #fff;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-name {
    color: #fff;
    font-size: 13px;
}

.logout-link {
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
}

.logout-link:hover {
    color: #fff;
}

/* 主内容区 */
.main {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 18px 32px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.content {
    padding: 24px 32px;
    flex: 1;
}

/* 提示消息 */
.flash {
    padding: 12px 20px;
    margin: 16px 32px 0;
    border-radius: 6px;
    font-size: 14px;
}

.flash-success {
    background: #dcfce7;
    color: var(--success);
    border: 1px solid #86efac;
}

.flash-error {
    background: #fee2e2;
    color: var(--danger);
    border: 1px solid #fca5a5;
}

.flash-warning {
    background: #fef3c7;
    color: var(--warning);
    border: 1px solid #fcd34d;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

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

/* 按钮 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

/* 表格 */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--muted);
    font-size: 13px;
}

tr:hover td {
    background: #f8fafc;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #334155;
}

.form-group label .required {
    color: var(--danger);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="datetime-local"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

/* 徽章 */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-timeout { background: #fee2e2; color: var(--danger); }
.badge-warn    { background: #fef3c7; color: var(--warning); }
.badge-normal  { background: #e0e7ff; color: var(--primary); }
.badge-gray    { background: #e2e8f0; color: var(--muted); }

.badge-status-pending    { background: #e0e7ff; color: var(--primary); }
.badge-status-processing { background: #fef3c7; color: var(--warning); }
.badge-status-completed  { background: #dcfce7; color: var(--success); }
.badge-status-closed     { background: #e2e8f0; color: var(--muted); }

.badge-priority-urgent { background: #fee2e2; color: var(--danger); }
.badge-priority-high   { background: #ffedd5; color: var(--warning); }
.badge-priority-normal { background: #e0e7ff; color: var(--primary); }
.badge-priority-low    { background: #e2e8f0; color: var(--muted); }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 20px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.primary .stat-value { color: var(--primary); }

/* 登录页 */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--muted);
    margin-bottom: 28px;
    font-size: 14px;
}

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

/* 详情页 */
.detail-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px 16px;
}

.detail-label {
    color: var(--muted);
    font-weight: 500;
}

.detail-value {
    word-break: break-word;
}

/* 日志页 IP 归属地 */
.ip-location {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.record-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 12px;
}

.record-meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.record-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
}

.attachment-item a {
    color: var(--primary);
    text-decoration: none;
    flex: 1;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 40px;
}

/* 漏洞等级徽章 */
.badge-level-critical { background: #7f1d1d; color: #fff; }
.badge-level-high     { background: #fee2e2; color: var(--danger); }
.badge-level-medium   { background: #fef3c7; color: var(--warning); }
.badge-level-low      { background: #e0e7ff; color: var(--primary); }

/* 漏洞状态徽章 */
.badge-status-open    { background: #fee2e2; color: var(--danger); }
.badge-status-fixed   { background: #dcfce7; color: var(--success); }
.badge-status-ignored { background: #e2e8f0; color: var(--muted); }

/* 富文本编辑器（wangEditor） */
.wang-editor {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.wang-editor .wang-editor-toolbar {
    border-bottom: 1px solid var(--border);
}

.wang-editor .wang-editor-body {
    min-height: 200px;
}

/* 富文本展示 */
.rich-text {
    line-height: 1.7;
}

.rich-text ul,
.rich-text ol {
    padding-left: 24px;
    margin: 6px 0;
}

.rich-text img {
    max-width: 100%;
}

.rich-text table {
    border-collapse: collapse;
    margin: 8px 0;
}

.rich-text table th,
.rich-text table td {
    border: 1px solid var(--border);
    padding: 4px 10px;
}

.rich-text blockquote {
    border-left: 4px solid var(--border);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--muted);
}

.rich-text pre {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px;
    overflow-x: auto;
}

.rich-text pre code {
    background: transparent;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}
