/* ============================================================================
   云核动力管理后台 · 设计基础
   设计令牌提取自官网 yunhedongli-website 真实代码：
   品牌红 #e63946 / 底色 #0a0a0f / 银色文字 #f0f0f5 #c0c0c0 / 白 alpha 边框
   风格：深色石墨 + Fluent 质感，克制、高信息密度
   ========================================================================== */

:root {
    /* 中性色 */
    --bg-base: #0a0a0f;            /* 官网 --bg-base */
    --surface: #101016;            /* 面板 */
    --surface-2: #14141c;          /* 次级面板 / 输入底 */
    --surface-3: #191922;          /* hover / elevated */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text-main: #f0f0f5;          /* 官网 --text-main */
    --text-secondary: #b8bac2;
    --text-muted: #8b8d95;         /* 官网 --text-muted */
    --silver: #c0c0c0;             /* 官网 --silver */

    /* 品牌红 */
    --brand: #e63946;              /* 官网 --green */
    --brand-hover: #ef4a56;
    --brand-dim: #2d1518;          /* 官网 --dim-green */
    --brand-border: rgba(230, 57, 70, 0.15);   /* 官网 --border-green */
    --brand-glow: rgba(230, 57, 70, 0.25);     /* 官网 --glow 弱化 */

    /* 语义色（独立于品牌红） */
    --success: #4ade80;
    --success-dim: rgba(34, 197, 94, 0.12);
    --success-border: rgba(74, 222, 128, 0.35);
    --warning: #fbbf24;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(251, 191, 36, 0.35);
    --error: #f87171;
    --error-dim: rgba(239, 68, 68, 0.12);
    --error-border: rgba(248, 113, 113, 0.38);
    --info: #7db4f5;
    --info-dim: rgba(96, 165, 250, 0.12);
    --info-border: rgba(125, 180, 245, 0.35);

    /* 形状与层级 */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.55), 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.45);
    --sidebar-w: 232px;

    --font-body: 'Space Grotesk', -apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-main);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(230, 57, 70, 0.45); }

/* 滚动条（Fluent 细滚动条） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.25); }

.mono { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-secondary); }
.nowrap { white-space: nowrap; }

/* ==========================================================================
   布局骨架：左侧导航 + 顶栏 + 内容区
   ========================================================================== */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0d0d13, #0a0a0f);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img { width: 34px; height: 34px; border-radius: 8px; }
.sidebar-brand .brand-name { font-weight: 700; font-size: 15px; letter-spacing: 1px; line-height: 1.2; }
.sidebar-brand .brand-sub { font-size: 12px; color: var(--text-muted); letter-spacing: 2px; }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13.5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s;
    position: relative;
    white-space: nowrap;
}

.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.85; }

.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-main); }

.nav-item.active {
    background: var(--brand-dim);
    color: #fff;
    border-color: var(--brand-border);
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: -10px; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 2px;
    background: var(--brand);
}
.nav-item.active svg { color: var(--brand); opacity: 1; }

.nav-count {
    margin-left: auto;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
}
.nav-count.alert { background: var(--warning-dim); color: var(--warning); border: 1px solid var(--warning-border); }

.nav-section {
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 14px 12px 6px;
}

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

/* 主区域 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 56px;
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(16, 16, 22, 0.82);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; }
.topbar-sub { font-size: 12px; color: var(--text-muted); margin-left: 2px; }
.topbar-spacer { flex: 1; }
.topbar-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

.content { padding: 22px; flex: 1; min-width: 0; }

/* 管理员菜单 */
.admin-menu { position: relative; }
.admin-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-main);
    cursor: pointer;
    font-size: 13px;
}
.admin-menu-btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--brand-dim);
    border: 1px solid var(--brand-border);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}

/* ==========================================================================
   页面结构：标题区 → 筛选工具栏 → 数据区 → 分页区
   ========================================================================== */

.page-head { display: flex; align-items: flex-start; gap: 14px; margin: 2px 0 16px; }
.page-title { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: 0.3px; }
.page-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.page-head .spacer { flex: 1; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.toolbar .divider { width: 1px; height: 22px; background: var(--border-strong); margin: 0 2px; }
.toolbar .grow { flex: 1; }
.toolbar-label { font-size: 12.5px; color: var(--text-muted); }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.panel + .panel { margin-top: 16px; }
.panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 14.5px; font-weight: 700; }
.panel-hint { font-size: 12px; color: var(--text-muted); }
.panel-body { padding: 16px; }
.panel-head .spacer, .page-head .spacer { flex: 1; }

/* ==========================================================================
   组件：按钮
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-main);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.2); }
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 4px 14px var(--brand-glow);
}
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn.ok {
    background: var(--success-dim);
    border-color: var(--success-border);
    color: var(--success);
}
.btn.ok:hover { background: rgba(34, 197, 94, 0.2); }

.btn.danger {
    background: var(--error-dim);
    border-color: var(--error-border);
    color: var(--error);
}
.btn.danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: transparent; color: var(--text-main); }

.btn.sm { height: 27px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn.lg { height: 42px; padding: 0 20px; font-size: 14px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.link-btn {
    color: var(--info);
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ==========================================================================
   组件：输入 / 选择 / 文本域 / 开关
   ========================================================================== */

.input, .select, .textarea {
    height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-main);
    font-family: inherit;
    font-size: 13px;
    padding: 0 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: rgba(139, 141, 149, 0.7); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}
.input.mono { font-family: var(--font-mono); }

.select { padding-right: 26px; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b8d95' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
}
.select option { background: var(--surface-2); color: var(--text-main); }

.textarea {
    height: auto;
    min-height: 72px;
    padding: 8px 10px;
    resize: vertical;
    line-height: 1.55;
}

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
    position: absolute; inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border-strong);
    transition: background 0.18s;
    cursor: pointer;
}
.switch .track::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 15px; height: 15px;
    border-radius: 50%;
    background: #dcdce2;
    transition: transform 0.18s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch input:checked + .track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); background: #fff; }
.switch input:disabled + .track { opacity: 0.5; cursor: not-allowed; }

.field { display: grid; gap: 6px; }
.field > label, .field-label { font-size: 12.5px; color: var(--text-muted); }
.field .hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ==========================================================================
   组件：表格
   ========================================================================== */

.table-wrap { overflow-x: auto; background: var(--surface); }
.table-wrap.bordered-top { border-top: 1px solid var(--border); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }

table.data th, table.data td {
    text-align: left;
    padding: 10px 11px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
table.data th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.4px;
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid var(--border-strong);
    position: sticky;
    top: 0;
}
table.data td.wrap { white-space: normal; word-break: break-all; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .cell-main { font-weight: 500; color: var(--text-main); }
table.data td.col-subs { max-width: 430px; }
table.data .cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
table.data .cell-sub.mono { font-size: 11.5px; }
td.empty-line { padding: 0; border-bottom: none; height: 8px; background: transparent; }

.row-actions { display: flex; align-items: center; gap: 6px; }

/* ==========================================================================
   组件：徽章 / 状态点
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 2.5px 9px;
    font-size: 12px;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    white-space: nowrap;
    line-height: 1.5;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }

.badge.success { color: var(--success); background: var(--success-dim); border-color: var(--success-border); }
.badge.warning { color: var(--warning); background: var(--warning-dim); border-color: var(--warning-border); }
.badge.error { color: var(--error); background: var(--error-dim); border-color: var(--error-border); }
.badge.info { color: var(--info); background: var(--info-dim); border-color: var(--info-border); }
.badge.brand { color: var(--brand); background: var(--brand-dim); border-color: var(--brand-border); }
.badge.neutral { color: var(--text-muted); }

/* ==========================================================================
   组件：统计卡片（概览）
   ========================================================================== */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    min-width: 0;
}
.stat-card:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.stat-card .stat-value { font-size: 25px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.stat-card .stat-note { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.stat-card.alert { border-color: var(--warning-border); background: linear-gradient(180deg, rgba(245, 158, 11, 0.06), var(--surface)); }
.stat-card.alert .stat-value { color: var(--warning); }

/* 待处理条 */
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.todo-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 13px 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.todo-card:hover { border-color: var(--brand-border); background: var(--surface-2); }
.todo-card .todo-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
}
.todo-card .todo-icon svg { width: 17px; height: 17px; }
.todo-card.warn .todo-icon { background: var(--warning-dim); color: var(--warning); }
.todo-card.brand .todo-icon { background: var(--brand-dim); color: var(--brand); }
.todo-card .todo-title { font-size: 13px; color: var(--text-secondary); }
.todo-card .todo-value { font-size: 17px; font-weight: 700; margin-top: 1px; }
.todo-card .todo-go { margin-left: auto; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.todo-card:hover .todo-go { color: var(--brand); }

/* ==========================================================================
   组件：Modal / Drawer
   ========================================================================== */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(5, 5, 9, 0.72);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.overlay.open { display: flex; }

.modal {
    width: min(680px, 100%);
    max-height: min(86vh, 900px);
    display: flex;
    flex-direction: column;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    animation: modal-in 0.16s ease-out;
}
.modal.sm { width: min(440px, 100%); }
.modal.lg { width: min(860px, 100%); }

@keyframes modal-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.modal-title { font-size: 15.5px; font-weight: 700; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex: 0 0 auto;
}
.modal-foot .spacer { flex: 1; }
.modal-foot .foot-msg { font-size: 12.5px; color: var(--text-muted); }

.icon-btn {
    width: 30px; height: 30px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text-main); }

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(5, 5, 9, 0.6);
    backdrop-filter: blur(4px);
    display: none;
}
.drawer-overlay.open { display: block; }

.drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 56;
    width: min(520px, 92vw);
    background: var(--surface-2);
    border-left: 1px solid var(--border-strong);
    box-shadow: var(--shadow-modal);
    transform: translateX(100%);
    transition: transform 0.2s ease-out;
    display: flex;
    flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.drawer-title { font-size: 15.5px; font-weight: 700; }
.drawer-head .spacer { flex: 1; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); flex: 0 0 auto; display: flex; gap: 10px; }

/* 详情键值对 */
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.kv-grid.single { grid-template-columns: 1fr; }
.kv .k { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.kv .v { font-size: 13.5px; word-break: break-all; line-height: 1.5; }
.kv .v.money { font-variant-numeric: tabular-nums; font-weight: 600; }

.sub-section { margin-top: 20px; }
.sub-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sub-section-title .spacer { flex: 1; }

/* ==========================================================================
   组件：Toast
   ========================================================================== */

.toast-box {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: var(--shadow-pop);
    font-size: 13px;
    animation: toast-in 0.18s ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: none; }
}
.toast.out { opacity: 0; transform: translateX(14px); transition: 0.2s; }
.toast .t-icon { flex: 0 0 auto; font-size: 14px; line-height: 1.3; }
.toast.success .t-icon { color: var(--success); }
.toast.error .t-icon { color: var(--error); }
.toast.info .t-icon { color: var(--info); }
.toast .t-text { flex: 1; word-break: break-word; }
.toast .t-close { flex: 0 0 auto; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
.toast .t-close:hover { color: var(--text-main); }

/* ==========================================================================
   组件：Loading / Empty / Error
   ========================================================================== */

.state-block { padding: 42px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.state-block .state-icon { font-size: 26px; margin-bottom: 10px; opacity: 0.75; }
.state-block .state-title { font-size: 14px; color: var(--text-secondary); font-weight: 600; margin-bottom: 4px; }
.state-block .state-desc { max-width: 420px; margin: 0 auto 12px; line-height: 1.6; }
.state-block.compact { padding: 24px 16px; }

.spinner {
    width: 22px; height: 22px;
    margin: 0 auto 10px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--brand);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-rows td { padding: 18px 14px; }
.skeleton {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.11) 45%, rgba(255,255,255,0.05) 65%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.btn .spinner-inline {
    width: 14px; height: 14px;
    margin: 0;
    border-width: 2px;
    display: inline-block;
    vertical-align: -2px;
}

/* ==========================================================================
   组件：分页
   ========================================================================== */

.pager {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.pager .pager-info { font-variant-numeric: tabular-nums; }
.pager .spacer { flex: 1; }
.pager .pager-btns { display: flex; gap: 5px; }
.pager button {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12.5px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}
.pager button:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-main); }
.pager button.cur { background: var(--brand-dim); border-color: var(--brand-border); color: var(--brand); font-weight: 700; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

.cap-note {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--warning-dim);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
}

/* ==========================================================================
   组件：复制按钮 / 键值
   ========================================================================== */

.copy-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    margin: -1px -5px;
    transition: background 0.12s;
}
.copy-chip:hover { background: rgba(255, 255, 255, 0.06); }
.copy-chip .cp-icon { color: var(--text-muted); font-size: 11px; opacity: 0; transition: opacity 0.12s; flex: 0 0 auto; }
.copy-chip:hover .cp-icon { opacity: 1; }

.trunc {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* ==========================================================================
   组件：下拉菜单
   ========================================================================== */

.menu { position: relative; display: inline-block; }
.menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    z-index: 50;
    min-width: 150px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 5px;
    display: none;
}
.menu-list.open { display: block; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.07); color: var(--text-main); }
.menu-item.danger { color: var(--error); }
.menu-item.danger:hover { background: var(--error-dim); }
.menu-item.ok { color: var(--success); }
.menu-item.ok:hover { background: var(--success-dim); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ==========================================================================
   产品定价面板
   ========================================================================== */

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 16px; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.product-card.dirty { border-color: var(--warning-border); }
.product-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015);
}
.product-card-head .p-name { font-size: 15.5px; font-weight: 700; }
.product-card-head .p-slug { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.product-card-head .spacer { flex: 1; }
.product-card-body { padding: 16px 18px; }

.price-row {
    display: grid;
    grid-template-columns: 92px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
}
.price-row + .price-row { border-top: 1px dashed var(--border); }
.price-row .pr-label { font-size: 13px; color: var(--text-secondary); }
.price-row .pr-label .pr-sub { display: block; font-size: 11.5px; color: var(--text-muted); }
.price-row .pr-diff { font-size: 12px; min-width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.diff-up { color: var(--warning); }
.diff-down { color: var(--success); }
.diff-same { color: var(--text-muted); }

.product-card-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
}
.product-card-foot .spacer { flex: 1; }
.dirty-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--warning);
    font-size: 12px;
}

/* ==========================================================================
   登录页
   ========================================================================== */

.login-bg {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(ellipse 90% 55% at 50% -10%, rgba(230, 57, 70, 0.13), transparent 60%),
        radial-gradient(ellipse 60% 40% at 85% 110%, rgba(230, 57, 70, 0.07), transparent 60%),
        var(--bg-base);
}
.login-card {
    width: min(420px, 100%);
    background: rgba(16, 16, 22, 0.85);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 30px 28px;
    box-shadow: var(--shadow-modal);
    backdrop-filter: blur(14px);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.login-brand img { width: 40px; height: 40px; border-radius: 9px; }
.login-brand .brand-name { font-weight: 700; font-size: 16px; letter-spacing: 1px; }
.login-brand .brand-sub { font-size: 12px; color: var(--text-muted); letter-spacing: 2.5px; }
.login-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.login-desc { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }
.login-form { display: grid; gap: 13px; }
.login-form .input { height: 42px; font-size: 14px; }
.login-form .btn { height: 42px; font-size: 14px; }
.form-msg { min-height: 20px; font-size: 13px; color: var(--error); }
.security-note {
    margin-top: 18px;
    padding: 11px 13px;
    border: 1px solid var(--warning-border);
    border-radius: var(--radius);
    background: var(--warning-dim);
    color: var(--warning);
    font-size: 12.5px;
    line-height: 1.65;
}
.login-foot { margin-top: 22px; text-align: center; font-size: 12px; color: var(--text-muted); letter-spacing: 1px; }

/* ==========================================================================
   其它
   ========================================================================== */

code.inline {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

.crumbs { font-size: 12px; color: var(--text-muted); }
.crumbs b { color: var(--text-secondary); font-weight: 500; }

[hidden] { display: none !important; }

.fade-in { animation: fade-in 0.18s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 响应式 */
@media (max-width: 1100px) {
    .product-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.2s;
        box-shadow: var(--shadow-modal);
    }
    .sidebar.open { transform: none; }
    .content { padding: 16px 14px; }
    .kv-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 14px; }
    .topbar-meta { display: none; }
}

.menu-btn { display: none; }
@media (max-width: 900px) {
    .menu-btn {
        display: grid;
        place-items: center;
        width: 34px; height: 34px;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        background: var(--surface-2);
        color: var(--text-main);
        cursor: pointer;
    }
}
