/* ============================================================
   KinCalc Admin — 后台管理样式 · 工业控制台 (Industrial Console)
   2026-08-27 整体重设计：深色 L 形外框 + 电信号蓝 + 等宽数字
   ============================================================ */

:root {
    /* —— 旧变量名保留（页面内联样式仍在引用），值已映射到新配色 —— */
    --primary: #2F6BFF;
    --primary-light: #3E86FF;
    --dark: #0C1424;
    --text: #17202E;
    --text-secondary: #5A6A82;
    --gray: #6B7A90;
    --gray-light: #97A4B8;
    --bg: #F3F5FA;
    --white: #FFFFFF;
    --border: #E7EBF3;
    --success: #0FA16B;
    --warning: #DE8A00;
    --danger: #E5484D;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(12, 20, 36, 0.05);

    /* —— 新设计令牌 —— */
    --ink: #0C1424;
    --ink-soft: #111C31;
    --ink-raise: #16223A;
    --ink-line: rgba(255, 255, 255, 0.07);
    --ink-text: #C9D4E6;
    --ink-dim: #7E8DA6;
    --signal: #3E86FF;
    --signal-hot: #55C8FF;
    --signal-soft: rgba(62, 134, 255, 0.12);
    --canvas: #F3F5FA;
    --surface: #FFFFFF;
    --line: #E7EBF3;
    --success-soft: #E5F6EE;
    --warning-soft: #FCF2E0;
    --danger-soft: #FDECEC;

    --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Consolas", "JetBrains Mono", "SF Mono", ui-monospace, "Microsoft YaHei", monospace;
}

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

html, body {
    min-height: 100vh;
}

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--canvas);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--primary);
}

:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

/* ============================================================
   SHELL —— 深色 L 形外框（侧栏 + 顶栏）
   ============================================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
    margin-left: 232px;
    padding-top: 56px;
}

/* ---------- 顶栏 ---------- */
.admin-topbar {
    position: fixed;
    top: 0;
    left: 232px;
    right: 0;
    z-index: 1001;
    height: 56px;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

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

.topbar-crumb {
    color: var(--ink-dim);
    font-size: 13px;
    letter-spacing: 0.01em;
}

.topbar-crumb b {
    color: #fff;
    font-weight: 600;
}

.topbar-crumb-sep {
    color: var(--ink-dim);
    opacity: 0.55;
    margin: 0 8px;
}

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

.topbar-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-text);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.18s;
}

.topbar-home i,
.topbar-home svg {
    width: 18px;
    height: 18px;
    font-size: 14px;
    color: var(--ink-dim);
}

.topbar-home:hover {
    color: #fff;
}

.topbar-home:hover i,
.topbar-home:hover svg {
    color: var(--signal-hot);
}

.topbar-user {
    position: relative;
    height: 56px;
    display: flex;
    align-items: center;
}

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 100%;
    padding: 0 8px;
    background: none;
    border: none;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}

.topbar-user-btn:hover {
    background: var(--ink-raise);
}

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--signal), var(--signal-hot));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.topbar-user-btn .fa-chevron-down {
    font-size: 11px;
    color: var(--ink-dim);
}

.topbar-user-btn svg {
    width: 14px;
    height: 14px;
    color: var(--ink-dim);
    flex-shrink: 0;
}

.topbar-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 156px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(12, 20, 36, 0.18);
    padding: 6px;
    display: none;
    z-index: 1002;
}

.topbar-dropdown.open {
    display: block;
}

.topbar-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s;
}

.topbar-dropdown a:hover {
    background: var(--canvas);
}

.topbar-dropdown a i,
.topbar-dropdown a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    text-align: center;
    color: var(--gray);
}

.topbar-dropdown a:last-child:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.topbar-dropdown a:last-child:hover i {
    color: var(--danger);
}

/* ---------- 侧栏 ---------- */
.admin-sidebar {
    width: 232px;
    background: var(--ink);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 20px;
    border-bottom: 1px solid var(--ink-line);
}

.sidebar-brand img {
    height: 34px;
    width: auto;
    display: block;
}

.sidebar-brand-sub {
    color: var(--ink-dim);
    font-size: 11px;
    letter-spacing: 0.06em;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 14px 14px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.nav-group-label {
    color: var(--ink-dim);
    font-size: 11px;
    letter-spacing: 0.14em;
    padding: 18px 12px 7px;
    text-transform: uppercase;
}

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--ink-text);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 2px;
    transition: background 0.18s, color 0.18s;
}

.sidebar-nav a i,
.sidebar-nav a svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    text-align: center;
    font-size: 15px;
    color: var(--ink-dim);
    transition: color 0.18s;
}

.sidebar-nav a:hover {
    background: var(--ink-soft);
    color: #fff;
}

.sidebar-nav a:hover i,
.sidebar-nav a:hover svg {
    color: var(--ink-text);
}

.sidebar-nav a.active {
    background: var(--ink-raise);
    color: #fff;
    font-weight: 600;
}

.sidebar-nav a.active i,
.sidebar-nav a.active svg {
    color: var(--signal-hot);
}

/* 签名元素：选中项左侧「通电导线」发光竖条 */
.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--signal-hot), var(--signal));
    box-shadow: 0 0 9px rgba(62, 134, 255, 0.9), 0 0 2px rgba(85, 200, 255, 0.9);
}

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

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--ink-text);
    text-decoration: none;
    font-size: 13.5px;
    transition: all 0.18s;
}

.sidebar-footer a i,
.sidebar-footer a svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    text-align: center;
    font-size: 15px;
    color: var(--ink-dim);
}

.sidebar-footer a:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.sidebar-footer a:hover i,
.sidebar-footer a:hover svg {
    color: var(--danger);
}

/* ---------- 主区 ---------- */
.admin-main {
    flex: 1;
    min-width: 0;
    padding: 28px 28px 40px;
}

.admin-content {
    width: 100%;
}

/* ---------- 页脚（轻量） ---------- */
.admin-footer {
    margin-left: 232px;
    border-top: 1px solid var(--line);
    padding: 22px 24px 30px;
    text-align: center;
    color: var(--gray-light);
    font-size: 12.5px;
    background: var(--canvas);
}

.admin-footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-footer .footer-sep {
    color: var(--line);
}

/* ============================================================
   LOGIN / AUTH 页面
   ============================================================ */

.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 18% 40%, rgba(62, 134, 255, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 82% 15%, rgba(85, 200, 255, 0.10) 0%, transparent 50%),
        var(--ink);
}

.admin-login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 44px 44px;
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 44px 40px 36px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

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

.login-logo {
    height: 52px;
    width: auto;
    margin-bottom: 14px;
}

.login-header h1 {
    font-size: 1.4rem;
    color: var(--dark);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--gray);
    font-size: 0.88rem;
}

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

.login-form label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(62, 134, 255, 0.14);
}

.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    min-height: 20px;
    margin-bottom: 8px;
    display: none;
}

.form-error.show {
    display: block;
}

.input-error {
    border-color: var(--warning) !important;
    box-shadow: 0 0 0 3px rgba(222, 138, 0, 0.15) !important;
}

.captcha-box.input-error .captcha-img {
    border-color: var(--warning);
    box-shadow: 0 0 0 3px rgba(222, 138, 0, 0.15);
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--signal-hot), var(--signal));
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 6px 18px rgba(62, 134, 255, 0.32);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 24px rgba(62, 134, 255, 0.42);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    text-align: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.login-footer a {
    color: var(--gray);
    font-size: 0.85rem;
}

.login-footer a:hover {
    color: var(--signal);
}

/* ============================================================
   页面工具栏（标题 + 走线）
   ============================================================ */

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 14px;
    position: relative;
    border-bottom: 1px solid var(--line);
}

.page-toolbar::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 64px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--signal), transparent);
}

.page-toolbar::before {
    content: "";
    position: absolute;
    left: 60px;
    bottom: -3.5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--signal-hot);
    box-shadow: 0 0 8px 2px rgba(85, 200, 255, 0.75);
}

.page-toolbar h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.page-toolbar h2 i {
    color: var(--signal);
    margin-right: 4px;
}

/* ============================================================
   按钮体系（胶囊 + 蓝渐变）
   ============================================================ */

.btn-primary-sm,
.btn-filter,
.btn-publish {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: linear-gradient(135deg, var(--signal-hot), var(--signal));
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font);
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(62, 134, 255, 0.28);
}

.btn-primary-sm:hover,
.btn-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 20px rgba(62, 134, 255, 0.4);
    color: #fff;
}

.btn-publish {
    background: linear-gradient(135deg, #39C791, var(--success));
    box-shadow: 0 4px 14px rgba(15, 161, 107, 0.28);
}

.btn-publish:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 20px rgba(15, 161, 107, 0.4);
}

.btn-reset-sm,
.btn-reset {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font);
    transition: all 0.18s;
}

.btn-reset-sm:hover,
.btn-reset:hover {
    background: var(--canvas);
    border-color: #cfd8e6;
}

.btn-sm {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font);
    color: var(--text-secondary);
    transition: all 0.15s;
}

.btn-sm:hover {
    background: var(--signal);
    color: #fff;
    border-color: var(--signal);
}

.btn-close {
    background: var(--canvas);
    color: var(--text-secondary);
}

.btn-mark-read {
    background: linear-gradient(135deg, #39C791, var(--success));
    color: #fff;
    box-shadow: 0 4px 14px rgba(15, 161, 107, 0.28);
}

/* ============================================================
   统计卡
   ============================================================ */

/* 老式渐变卡（messages / logs）→ 重设计为白卡 + 光晕 */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 20px;
}

.stat-card::after {
    content: "";
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(62, 134, 255, 0.10), transparent 70%);
    pointer-events: none;
}

.stat-card .stat-num {
    font-family: var(--mono);
    font-size: 30px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* 控制面板 stat 卡（带图标） */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dash-stats.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.dash-stats.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.dash-stat {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s;
}

.dash-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(12, 20, 36, 0.09);
}

.dash-stat::after {
    content: "";
    position: absolute;
    top: -28px;
    right: -28px;
    width: 110px;
    height: 110px;
    background: radial-gradient(circle, rgba(62, 134, 255, 0.09), transparent 70%);
    pointer-events: none;
}

.dash-icon {
    width: 56px;
    height: 56px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.dash-meta {
    min-width: 0;
}

.dash-num {
    font-family: var(--mono);
    font-size: 26px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text);
}

.dash-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* 仪表盘两栏 */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 16px;
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 20px;
}

.dash-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.dash-card-title i {
    color: var(--signal);
    margin-right: 4px;
}

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

.topic-row:last-child {
    margin-bottom: 0;
}

.topic-name {
    width: 70px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.topic-bar {
    flex: 1;
    height: 8px;
    background: #EEF1F7;
    border-radius: 4px;
    overflow: hidden;
}

.topic-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--signal), var(--signal-hot));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.topic-count {
    width: 40px;
    font-size: 13px;
    font-family: var(--mono);
    color: var(--text);
    text-align: right;
    flex-shrink: 0;
    font-weight: 600;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

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

.recent-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--signal), var(--signal-hot));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

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

.recent-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-company {
    font-size: 12px;
    color: var(--gray-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-right {
    text-align: right;
    flex-shrink: 0;
}

.recent-topic {
    display: inline-block;
    font-size: 11.5px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--signal-soft);
    color: var(--signal);
}

.recent-time {
    font-size: 11.5px;
    font-family: var(--mono);
    color: var(--gray-light);
    margin-top: 3px;
}

/* ============================================================
   筛选栏 / 输入
   ============================================================ */

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: var(--surface);
    padding: 14px 16px;
    border-radius: 13px;
    border: 1px solid var(--line);
    margin-bottom: 16px;
    box-sizing: border-box;
}

.filter-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: var(--font);
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(62, 134, 255, 0.12);
}

.filter-select,
.filter-date {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: var(--font);
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-select:focus,
.filter-date:focus {
    outline: none;
    border-color: var(--signal);
}

.form-control {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: var(--font);
    background: #fff;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.form-control:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(62, 134, 255, 0.12);
}

/* ============================================================
   数据表格
   ============================================================ */

.table-wrap {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: #F8FAFD;
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    font-size: 12.5px;
    letter-spacing: 0.01em;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    color: var(--text);
}

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

.data-table tbody tr:hover {
    background: #F8FAFD;
}

.data-table tbody tr.unread-row {
    background: #FDF8E9;
}

.data-table tbody tr.unread-row:hover {
    background: #FBF1D4;
}

/* ID 列（每表首列）用等宽，读起来像仪表读数 */
.data-table td:first-child,
.data-table th:first-child {
    font-family: var(--mono);
    color: var(--text-secondary);
}

.data-table .msg-preview {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    color: var(--signal);
}

.data-table .msg-preview:hover {
    text-decoration: underline;
}

.badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
}

.badge-unread {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-read {
    background: var(--success-soft);
    color: var(--success);
}

.badge-topic {
    background: var(--signal-soft);
    color: var(--primary);
}

.empty-tip {
    text-align: center;
    padding: 48px;
    color: var(--gray-light);
    font-size: 0.92rem;
}

/* ============================================================
   分页
   ============================================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination button {
    min-width: 34px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--mono);
    color: var(--text-secondary);
    transition: all 0.15s;
}

.pagination button:hover {
    border-color: var(--signal);
    color: var(--signal);
}

.pagination button.active {
    background: var(--signal);
    color: #fff;
    border-color: var(--signal);
    font-weight: 600;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-info {
    color: var(--gray);
    font-size: 0.85rem;
    padding: 0 8px;
    font-family: var(--font);
}

/* ============================================================
   弹窗
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(12, 20, 36, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

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

.modal-card {
    background: var(--surface);
    border-radius: 14px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 70px rgba(12, 20, 36, 0.25);
}

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

.modal-header h3 {
    font-size: 1.08rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--gray);
    border-radius: 50%;
    transition: background 0.15s;
}

.modal-close:hover {
    background: var(--canvas);
}

.modal-body {
    padding: 24px;
}

.modal-body .detail-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px 16px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.modal-body .detail-label {
    color: var(--gray);
    font-weight: 600;
}

.modal-body .detail-value {
    color: var(--text);
}

.modal-body .detail-msg {
    margin-top: 16px;
    padding: 16px;
    background: var(--canvas);
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text);
}

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

.modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
}

/* ============================================================
   编辑器 / 表单卡片
   ============================================================ */

.editor-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 24px;
}

.editor-title-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font);
    background: #fff;
}

.editor-title-input:focus {
    outline: none;
    border-color: var(--signal);
    box-shadow: 0 0 0 3px rgba(62, 134, 255, 0.12);
}

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

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 1020px) {
    .dash-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 64px;
    }

    .admin-topbar {
        left: 64px;
    }

    .admin-layout {
        margin-left: 64px;
    }

    .admin-footer {
        margin-left: 64px;
    }

    .sidebar-brand {
        padding: 0 8px;
        align-items: center;
    }

    .sidebar-brand img {
        height: 26px;
    }

    .sidebar-brand-sub {
        display: none;
    }

    .nav-group-label {
        display: none;
    }

    .sidebar-nav a,
    .sidebar-footer a {
        justify-content: center;
        padding: 12px;
    }

    .sidebar-nav a span,
    .sidebar-footer a span {
        display: none;
    }

    .admin-main {
        padding: 20px 16px 32px;
    }

    .admin-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-num {
        font-size: 1.4rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-input {
        min-width: auto;
    }

    .data-table {
        font-size: 0.78rem;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .modal-card {
        width: 95%;
        max-height: 90vh;
    }

    .login-card {
        padding: 32px 24px 24px;
    }

    .topbar-crumb-sep,
    .topbar-crumb {
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================================
   Toast 动画
   ============================================================ */

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