/* ==========================================================
   CTrade 云智 · 内外贸一体化业务管理平台
   响应式设计系统（桌面 / 平板 / 手机）
   ========================================================== */

[hidden] { display: none !important; }

:root {
    --theme-color: #1d4ed8;
    --primary: var(--theme-color);
    --primary-500: color-mix(in srgb, var(--theme-color) 75%, white);
    --primary-600: color-mix(in srgb, var(--theme-color) 86%, white);
    --primary-700: color-mix(in srgb, var(--theme-color) 82%, black);
    --primary-50: color-mix(in srgb, var(--theme-color) 5%, white);
    --primary-100: color-mix(in srgb, var(--theme-color) 10%, white);
    --primary-200: color-mix(in srgb, var(--theme-color) 19%, white);
    --primary-300: color-mix(in srgb, var(--theme-color) 36%, white);
    --primary-400: color-mix(in srgb, var(--theme-color) 50%, white);
    --primary-ring: color-mix(in srgb, var(--theme-color) 12%, transparent);
    --accent: #0d9488;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e5eaf2;
    --line-2: #eef2f7;
    --bg: #f4f6fb;
    --card: rgba(255, 255, 255, .72);
    --glass-border: rgba(255, 255, 255, .58);
    --topbar-bg: rgba(255, 255, 255, .62);
    --sidebar-bg: linear-gradient(180deg, rgba(10, 30, 50, .86) 0%, rgba(9, 22, 38, .80) 60%, rgba(9, 22, 38, .82) 100%);
    --glass-shadow: 0 18px 50px -30px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .04);
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --info: #0284c7;
    --purple: #7c3aed;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px -18px rgba(15, 23, 42, .18);
    --sidebar-w: 246px;
    --font: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background-color: #eef4fb;
    background-image: url("../img/mountain-sea.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
img { max-width: 100%; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 布局 ---------------- */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 14px auto 14px 14px;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    backdrop-filter: saturate(1.35) blur(20px);
    -webkit-backdrop-filter: saturate(1.35) blur(20px);
    color: #c7d5e6;
    display: flex;
    flex-direction: column;
    z-index: 60;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 20px;
    box-shadow: 0 26px 70px -34px rgba(4, 18, 33, .68);
    overflow: hidden;
}

.sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--theme-color) 20%, transparent), transparent 45%);
    pointer-events: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 18px 18px;
    position: relative;
    z-index: 1;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary) 55%, var(--accent));
    color: #fff;
    font-weight: 800;
    font-size: 20px;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 14px color-mix(in srgb, var(--theme-color) 35%, transparent);
    flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: .2px; }
.brand-text span { color: #7f96b1; font-size: 11px; }

.nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px 16px;
    position: relative;
    z-index: 1;
    scrollbar-width: thin;
}

.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); }

.nav-group { margin-bottom: 3px; }

.nav-group-toggle {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 9px;
    cursor: pointer;
    position: relative;
    transition: background .22s ease, color .22s ease;
}

.nav-group-toggle:hover { background: rgba(255, 255, 255, .08); }
.nav-group.is-open > .nav-group-toggle {
    color: #fff;
    background: rgba(255, 255, 255, .05);
}
.nav-group.is-open > .nav-group-toggle::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 3px;
    background: var(--primary-400);
}
.nav-group.is-open > .nav-group-toggle .nav-chevron { transform: rotate(180deg); opacity: .9; }

.nav-ico { width: 19px; height: 19px; display: inline-flex; flex: none; transition: color .22s ease; }
.nav-ico svg, .nav-chevron svg { width: 19px; height: 19px; }
.nav-label { flex: 1; text-align: left; }
.nav-chevron { display: inline-flex; transition: transform .28s cubic-bezier(.2, .8, .3, 1), opacity .22s; opacity: .75; }
.nav-chevron svg { width: 15px; height: 15px; }

/* 手风琴：用 grid 行高做平滑展开动画，只展开一个分组 */
.nav-sub {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows .3s cubic-bezier(.2, .8, .3, 1), opacity .22s ease;
}
.nav-group.is-open .nav-sub { grid-template-rows: 1fr; opacity: 1; }
.nav-sub-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 0 0 12px;
    margin-left: 9px;
    border-left: 1px solid rgba(255, 255, 255, .08);
}
.nav-group.is-open .nav-sub-inner { padding-top: 2px; padding-bottom: 6px; }
.nav-sub .nav-link { transform: translateX(-6px); opacity: 0; transition: background .15s, color .15s, transform .28s ease, opacity .28s ease; }
.nav-group.is-open .nav-sub .nav-link { transform: translateX(0); opacity: 1; }
.nav-group.is-open .nav-sub .nav-link:nth-child(1) { transition-delay: .04s; }
.nav-group.is-open .nav-sub .nav-link:nth-child(2) { transition-delay: .06s; }
.nav-group.is-open .nav-sub .nav-link:nth-child(3) { transition-delay: .08s; }
.nav-group.is-open .nav-sub .nav-link:nth-child(4) { transition-delay: .1s; }
.nav-group.is-open .nav-sub .nav-link:nth-child(5) { transition-delay: .12s; }
.nav-group.is-open .nav-sub .nav-link:nth-child(n+6) { transition-delay: .14s; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 35px;
    padding: 0 10px;
    margin: 1px 0;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    transition: all .15s;
    position: relative;
}

.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, color-mix(in srgb, var(--theme-color) 95%, transparent), color-mix(in srgb, var(--primary-700) 75%, transparent));
    box-shadow: 0 4px 10px -5px rgba(4, 18, 33, .26), 0 1px 4px -2px rgba(4, 18, 33, .16);
    font-weight: 600;
}
.nav-link.active::before {
    content: "";
    position: absolute;
    left: -13px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 3px;
    background: var(--primary-400);
}

.nav-single {
    height: 42px;
    padding: 0 10px;
    margin: 2px 0;
    font-size: 13.5px;
    font-weight: 500;
}
.nav-single .nav-ico svg { width: 19px; height: 19px; }

.nav-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 17px;
    min-width: 18px;
    height: 17px;
    padding: 0 5px;
    border-radius: 9px;
    text-align: center;
}

.sidebar-foot {
    padding: 12px 18px 16px;
    border-top: 1px solid rgba(255, 255, 255, .06);
    position: relative;
    z-index: 1;
}
.sidebar-tip { display: flex; align-items: center; gap: 7px; font-size: 11px; color: #6e839b; }
.sidebar-tip .dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }

.main {
    margin-left: calc(var(--sidebar-w) + 28px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 14px;
    z-index: 40;
    height: 64px;
    margin: 14px 14px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: var(--topbar-bg);
    backdrop-filter: saturate(1.55) blur(22px);
    -webkit-backdrop-filter: saturate(1.55) blur(22px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: var(--glass-shadow);
}

.page-heading { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.page-heading h1 { font-size: 18px; font-weight: 680; letter-spacing: -.02em; }
.page-heading p { font-size: 12px; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.sidebar-toggle { display: none !important; }

.content { padding: 18px 18px 40px; width: 100%; max-width: 1560px; }

/* ---------------- 通用控件 ---------------- */
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    line-height: 1.2;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(180deg, var(--primary-600), var(--primary));
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--theme-color) 80%, transparent);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--primary), var(--primary-700)); border-color: var(--primary-700); color: #fff; }

.btn-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }
.btn-danger { background: #fff; border-color: #fecaca; color: #b91c1c; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.btn-warning { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; border-color: transparent; color: var(--ink); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { min-height: 28px; padding: 3px 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 46px; padding: 11px 22px; font-size: 15px; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

.icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    position: relative;
    transition: all .15s;
}
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.has-badge { overflow: visible; }
.has-badge .badge-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 13px;
    height: 13px;
    padding: 0 2px;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 8.5px;
    font-weight: 700;
    line-height: 13px;
    border: 1.5px solid #fff;
    box-sizing: content-box;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.badge-blue { background: var(--primary-50); color: var(--primary); }
.badge-green { background: #ecfdf5; color: #047857; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-gold { background: #fefce8; color: #a16207; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-dark { background: #1e293b; color: #e2e8f0; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }
.badge-cyan { background: #ecfeff; color: #0e7490; }
.badge-indigo { background: #eef2ff; color: #4338ca; }
.badge-teal { background: #f0fdfa; color: #0f766e; }

/* ---------------- 提示 ---------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid;
    font-size: 13.5px;
    animation: slideDown .25s ease;
}
.alert svg { width: 18px; height: 18px; margin-top: 1px; }
.alert span { flex: 1; }
.alert-close { border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .6; padding: 0 2px; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--primary-50); border-color: var(--primary-200); color: var(--primary-700); }

@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    backdrop-filter: saturate(1.45) blur(20px);
    -webkit-backdrop-filter: saturate(1.45) blur(20px);
    margin-bottom: 16px;
    overflow: hidden;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line-2);
    flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-title small { font-weight: 400; color: var(--muted); font-size: 12px; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); background: #fbfcfe; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: start; }
.grid > * { min-width: 0; }
.grid-main > * { min-width: 0; }

.filter-toggle { display: none; }

/* ---------------- 统计卡片 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
    background: var(--card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px 17px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: saturate(1.45) blur(20px);
    -webkit-backdrop-filter: saturate(1.45) blur(20px);
    position: relative;
    overflow: hidden;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--primary-50);
    color: var(--primary);
}
.stat-ico svg { width: 18px; height: 18px; }
.stat-ico.green { background: #ecfdf5; color: #059669; }
.stat-ico.orange { background: #fff7ed; color: #ea580c; }
.stat-ico.purple { background: #f5f3ff; color: #7c3aed; }
.stat-ico.teal { background: #f0fdfa; color: #0d9488; }
.stat-ico.red { background: #fef2f2; color: #dc2626; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat-sub { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.trend-up { color: #059669; font-weight: 600; }
.trend-down { color: #dc2626; font-weight: 600; }

/* ---------------- 表格 ---------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 760px;
}
table.data th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
    color: var(--ink-2);
}
table.data tbody tr:hover { background: #f9fbff; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .center { text-align: center; }
table.data .nowrap { white-space: nowrap; }
table.data .strong { color: var(--ink); font-weight: 600; }
table.data .muted { color: var(--muted); font-size: 12px; }
table.data a.link { font-weight: 600; color: var(--primary); }
table.data a.link:hover { text-decoration: underline; }
table.compact td { padding: 8px 12px; }
table.items { min-width: 640px; }
.grid-main .table-cards table.data { min-width: 640px; }

.row-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.row-actions .btn { min-height: 28px; padding: 3px 8px; font-size: 12px; }
.row-actions form { display: inline; }

.cell-title { font-weight: 600; color: var(--ink); display: block; }
.cell-sub { color: var(--muted); font-size: 11.5px; display: block; margin-top: 1px; }

.thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); background: #f1f5f9; }
.thumb-lg { width: 84px; height: 84px; border-radius: 12px; }

.table-card-note { display: none; }

/* ---------------- 筛选栏 ---------------- */
.filter-card {
    background: var(--card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: saturate(1.45) blur(20px);
    -webkit-backdrop-filter: saturate(1.45) blur(20px);
}
.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 10px;
    align-items: end;
}
.filter-form .filter-actions { display: flex; gap: 8px; align-items: center; }
.filter-form label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.filter-form input, .filter-form select {
    width: 100%;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: var(--ink);
    outline: none;
}
.filter-form input:focus, .filter-form select:focus { border-color: var(--primary-300); box-shadow: 0 0 0 3px var(--primary-ring); }
.filter-form .btn { height: 36px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------- 表单 ---------------- */
.opacity-control { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opacity-control input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--primary); }
.opacity-control input[type="number"] { width: 74px; text-align: center; }
.opacity-unit { color: var(--muted); }
.theme-color-control { display: flex; align-items: center; gap: 10px; }
.theme-color-control input[type="color"] { width: 46px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.theme-color-hex { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.theme-presets { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.theme-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; transition: transform .15s, box-shadow .15s; }
.theme-swatch:hover { transform: scale(1.12); }
.theme-swatch.active { box-shadow: 0 0 0 2px var(--primary); }
.form-card { background: var(--card); border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--glass-shadow); backdrop-filter: saturate(1.45) blur(20px); -webkit-backdrop-filter: saturate(1.45) blur(20px); }
.form-section { padding: 20px 22px; border-bottom: 1px solid var(--line-2); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; margin-bottom: 16px; }
.form-section-title::before { content: ""; width: 3px; height: 15px; border-radius: 2px; background: var(--primary); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-group { min-width: 0; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: 1 / -1; }
.form-label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 550; margin-bottom: 6px; }
.form-label em { color: #dc2626; font-style: normal; margin-left: 2px; }
.form-control input[type="text"],
.form-control input[type="password"],
.form-control input[type="number"],
.form-control input[type="date"],
.form-control input[type="datetime-local"],
.form-control input[type="email"],
.form-control input[type="tel"],
.form-control input[type="file"],
.form-control select,
.form-control textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-control input:focus, .form-control select:focus, .form-control textarea:focus {
    border-color: var(--primary-300);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-control input[readonly] { background: #f8fafc; color: var(--muted); }
.form-control textarea { min-height: 84px; resize: vertical; }
.form-control input[type="file"] { padding: 6px 8px; height: auto; }
.form-control input[type="color"] { width: 52px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; }
.form-group.has-error input, .form-group.has-error select, .form-group.has-error textarea { border-color: #fca5a5; background: #fffafa; }
.form-error { color: #dc2626; font-size: 11.5px; margin-top: 4px; }
.hint { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; line-height: 1.5; }
.hint a { font-weight: 500; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; min-height: 38px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; min-height: 40px; }
.radio-group label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.radio-group input { accent-color: var(--primary); width: 16px; height: 16px; }
.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--line-2);
    background: #fbfcfe;
    position: sticky;
    bottom: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    flex-wrap: wrap;
    z-index: 5;
}
.form-actions .spacer { flex: 1; }
.required-note { font-size: 11.5px; color: var(--muted-2); }

/* 明细行表格 */
.items-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.items-table th { padding: 8px 8px; font-size: 11.5px; color: var(--muted); text-align: left; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.items-table td { padding: 6px 6px; border-bottom: 1px solid var(--line-2); }
.items-table input, .items-table select {
    width: 100%;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 8px;
    outline: none;
    background: #fff;
}
.items-table input:focus, .items-table select:focus { border-color: var(--primary-300); box-shadow: 0 0 0 3px var(--primary-ring); }
.items-table input[readonly] { background: #f8fafc; color: var(--ink-2); font-weight: 600; }
.items-table .col-name { min-width: 190px; }
.items-table .col-price, .items-table .col-qty { width: 110px; }
.items-table .col-amount { width: 120px; }
.items-table .col-del { width: 44px; text-align: center; }
.items-foot { display: flex; justify-content: flex-end; padding: 12px 8px; gap: 24px; flex-wrap: wrap; }
.items-foot .total { font-size: 13px; color: var(--muted); }
.items-foot .total b { font-size: 20px; color: var(--primary-700); margin-left: 8px; font-variant-numeric: tabular-nums; }

/* ---------------- 详情 ---------------- */
.detail-hero {
    background: linear-gradient(120deg, #0f2d54, #144a86 70%, #0f766e);
    color: #fff;
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.detail-hero h2 { font-size: 20px; letter-spacing: -.01em; }
.detail-hero .doc-no { font-family: var(--mono); font-size: 12px; color: #b9d3ee; margin-top: 3px; }
.detail-hero .hero-amount { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.detail-hero .hero-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; }
.detail-hero .hero-meta div { font-size: 12px; color: #b9d3ee; }
.detail-hero .hero-meta b { display: block; color: #fff; font-size: 14px; font-weight: 600; margin-top: 2px; }
.detail-hero .hero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.detail-hero .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); color: #fff; }
.detail-hero .btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.detail-hero .btn-white { background: #fff; border-color: #fff; color: var(--primary-700); }

.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.info-list .item { padding: 10px 0; border-bottom: 1px dashed var(--line-2); display: flex; gap: 10px; align-items: baseline; }
.info-list .item:nth-last-child(-n+2) { border-bottom: 0; }
.info-list dt { font-size: 12.5px; color: var(--muted); width: 88px; flex: none; }
.info-list dd { margin: 0; font-size: 13.5px; color: var(--ink); min-width: 0; word-break: break-word; flex: 1; }
.info-list.single { grid-template-columns: 1fr; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 15px;
    font-size: 13.5px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-weight: 500;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.timeline { position: relative; padding: 4px 0 0 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 18px 6px; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -19px;
    top: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
}
.timeline-item.done::before { background: var(--primary); }
.timeline-item.cancel::before { border-color: #dc2626; }
.timeline-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.timeline-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.timeline-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; background: #f8fafc; border-radius: 8px; padding: 8px 10px; }

.steps { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 6px 0 2px; }
.step { flex: 1; min-width: 92px; text-align: center; position: relative; font-size: 11.5px; color: var(--muted); }
.step::after { content: ""; position: absolute; top: 12px; left: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.step:last-child::after { display: none; }
.step .dot { width: 25px; height: 25px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; margin: 0 auto 6px; position: relative; z-index: 1; font-size: 11px; color: var(--muted); font-weight: 600; }
.step.done { color: var(--primary-700); font-weight: 600; }
.step.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.current .dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .empty-ico { width: 56px; height: 56px; border-radius: 16px; background: #f1f5f9; color: #94a3b8; display: grid; place-items: center; margin: 0 auto 12px; }
.empty .empty-ico svg { width: 26px; height: 26px; }
.empty h4 { color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }
.empty p { font-size: 12.5px; }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.pagination-info { font-size: 12px; color: var(--muted); }
.pager { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-size: 12.5px;
}
.pager a:hover { border-color: var(--primary-300); color: var(--primary); }
.pager .current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .disabled { opacity: .45; pointer-events: none; }
.pager .gap { border: 0; background: none; color: var(--muted); }

/* ---------------- 移动端上拉加载更多 ---------------- */
.load-more {
    display: none;
    padding: 14px 0 10px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted-2);
    user-select: none;
}
.load-more.is-loading::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    vertical-align: -2px;
    border: 2px solid #dbe3ef;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.load-more.is-done { color: var(--muted-2); }
.load-more.is-failed { color: #dc2626; cursor: pointer; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 下拉菜单 ---------------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 178px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px -14px rgba(15, 23, 42, .28);
    padding: 6px;
    display: none;
    z-index: 80;
}
.dropdown.open .dropdown-menu { display: block; animation: slideDown .15s ease; }
.dropdown-menu.align-right { left: auto; right: 0; }
.dropdown-menu a, .dropdown-menu .dropdown-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--ink-2);
    font-size: 13px;
    width: 100%;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu .dropdown-link:hover { background: #f1f5f9; color: var(--ink); }
.dropdown-menu .icon { width: 16px; height: 16px; color: var(--muted); }
.dropdown-menu .danger { color: #b91c1c; }
.dropdown-menu .danger:hover { background: #fef2f2; }
.dropdown-head { padding: 9px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 5px; display: flex; flex-direction: column; }
.dropdown-head b { font-size: 13.5px; }
.dropdown-head small { font-size: 11.5px; color: var(--muted); }
.dropdown-form { margin: 0; }

.user-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 7px 4px 4px;
    border-radius: 11px;
    cursor: pointer;
}
.user-trigger:hover { background: #f1f5f9; }
.avatar { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; display: inline-grid; place-items: center; flex: none; }
.avatar-text { background: linear-gradient(135deg, var(--primary-600), var(--accent)); color: #fff; font-weight: 700; font-size: 14px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.user-meta b { font-size: 12.5px; font-weight: 600; }
.user-meta small { font-size: 10.5px; color: var(--muted); }
.user-trigger .chevron { width: 14px; height: 14px; color: var(--muted); }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 120; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .46); backdrop-filter: blur(2px); animation: fadeIn .18s; }
.modal-panel {
    position: relative;
    width: min(560px, calc(100% - 32px));
    max-height: calc(100vh - 80px);
    margin: 6vh auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .4);
    display: flex;
    flex-direction: column;
    animation: modalIn .2s cubic-bezier(.2, .8, .3, 1);
    overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 18px; overflow-y: auto; font-size: 13.5px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; background: #fbfcfe; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(15, 23, 42, .3); animation: slideDown .2s; }

/* ---------------- 图表 ---------------- */
.chart { width: 100%; min-height: 220px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-empty { display: grid; place-items: center; height: 220px; color: var(--muted-2); font-size: 12.5px; }

.progress { height: 7px; background: #eef2f7; border-radius: 5px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary-500), var(--primary-600)); }
.progress.green > span { background: #16a34a; }
.progress.orange > span { background: #f59e0b; }

/* ---------------- 登录页 ---------------- */
.auth-body { background: #f1f5fb; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-aside {
    background-color: #0b1f3a;
    background-image: linear-gradient(150deg, rgba(11, 31, 58, .86), rgba(12, 59, 70, .82)), url("../img/mountain-sea.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    color: #fff;
    padding: 42px 52px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.auth-aside::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    right: -160px;
    bottom: -180px;
    background: radial-gradient(circle, rgba(13, 148, 136, .35), transparent 65%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { width: 42px; height: 42px; font-size: 22px; }
.auth-brand strong { display: block; font-size: 17px; }
.auth-brand span { font-size: 12px; color: #9fb3cc; }
.auth-copy { margin-top: 9vh; max-width: 460px; }
.auth-copy h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.3; letter-spacing: -.02em; }
.auth-copy p { color: #a9bdd4; font-size: 14px; margin-top: 14px; max-width: 420px; line-height: 1.8; }
.auth-features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; max-width: 460px; }
.auth-features li { display: flex; gap: 12px; align-items: flex-start; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); border-radius: 12px; padding: 11px 14px; backdrop-filter: blur(4px); }
.feat-ico { width: 30px; height: 30px; border-radius: 9px; background: rgba(96, 165, 250, .18); color: var(--primary-300); display: grid; place-items: center; flex: none; }
.feat-ico svg { width: 17px; height: 17px; }
.auth-features b { display: block; font-size: 13px; font-weight: 600; }
.auth-features small { font-size: 11.5px; color: #9fb3cc; }
.auth-foot { margin-top: auto; padding-top: 28px; font-size: 11.5px; color: #6e839b; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 384px; }
.auth-card h2 { font-size: 24px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-top: 6px; margin-bottom: 24px; }
.auth-form { display: grid; gap: 15px; }
.auth-form .form-label { font-size: 12.5px; }
.auth-input { position: relative; }
.auth-input input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 42px 0 13px;
    font-size: 14px;
    outline: none;
    background: #fff;
}
.auth-input input:focus { border-color: var(--primary-300); box-shadow: 0 0 0 4px var(--primary-ring); }
.auth-input .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.auth-input .ico svg { width: 18px; height: 18px; }
.auth-input input { padding-left: 40px; }
.pwd-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; }
.pwd-toggle:hover { background: #f1f5f9; }
.checkbox-line { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.auth-extra { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); line-height: 1.8; }
.auth-alert { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 9px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 16px; display: flex; gap: 8px; }
.auth-alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

/* ---------------- 工具类 ---------------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.mobile-only { display: none; }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }
.tag { display: inline-block; background: #f1f5f9; color: var(--ink-2); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; margin: 1px 2px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.amount-lg { font-size: 18px; font-weight: 700; color: var(--primary-700); }
code, .mono { font-family: var(--mono); font-size: 12px; }
a.mono { color: var(--primary); }

.balance-box { background: linear-gradient(135deg, var(--primary-50), #f0fdfa); border: 1px solid var(--primary-100); border-radius: 12px; padding: 14px 16px; }
.balance-box .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.balance-box .row.total { border-top: 1px dashed var(--primary-200); margin-top: 6px; padding-top: 9px; font-weight: 700; font-size: 15px; }

.notice-list { list-style: none; padding: 0; margin: 0; }
.notice-list li { display: flex; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.notice-list li:last-child { border-bottom: 0; }
.notice-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; flex: none; }
.notice-ico svg { width: 17px; height: 17px; }
.notice-body { flex: 1; min-width: 0; }
.notice-body b { font-size: 13px; font-weight: 600; display: block; }
.notice-body p { font-size: 12.5px; color: var(--muted); }
.notice-time { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.notice-unread { background: #f8fbff; }

.upload-box { border: 1px dashed #cbd5e1; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); background: #fbfcfe; }
.upload-box input[type=file] { max-width: 100%; }

.product-picker { position: relative; }
.product-picker .item-product-search { width: 100%; }
.product-suggest-layer {
    position: fixed; z-index: 2000; max-height: 320px; overflow: auto; background: #fff;
    border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 42px rgba(15, 23, 42, .18); padding: 5px;
}
.product-suggest-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0;
    border-radius: 8px; background: transparent; text-align: left; cursor: pointer;
}
.product-suggest-item:hover, .product-suggest-item.active { background: var(--primary-50); }
.product-suggest-info { flex: 1; min-width: 0; }
.product-suggest-info b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-suggest-info small { display: block; color: var(--muted); font-size: 11.5px; }
.product-suggest-price { color: var(--primary); font-weight: 700; font-size: 12px; white-space: nowrap; }
.product-suggest-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 12.5px; }

.param-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 9px 10px; margin-bottom: 9px; border: 1px dashed #dbe3ee; border-radius: 9px; background: #fbfdff; }
.param-picker-label { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.param-chip { border: 1px solid var(--primary-200); background: var(--primary-50); color: var(--primary); border-radius: 999px; padding: 4px 9px; font-size: 11px; cursor: pointer; transition: .15s; }
.param-chip:hover { background: var(--primary-100); border-color: var(--primary-400); }

.custom-fields { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.custom-fields-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.custom-fields-head .form-label { margin: 0; }
.custom-field-list { display: flex; flex-direction: column; gap: 8px; }
.custom-field-row { display: grid; grid-template-columns: minmax(130px, 200px) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.custom-field-all { margin: 0; white-space: nowrap; }
.custom-field-all em { font-style: normal; font-size: 11.5px; color: var(--text-2); }
.custom-field-row input { width: 100%; min-height: 38px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; background: #fff; font-size: 12.5px; outline: none; }
.custom-field-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.custom-fields-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.custom-fields-foot .hint { margin: 0; }
@media (max-width: 760px) { .custom-field-row { grid-template-columns: 1fr; } .custom-field-row .btn { justify-self: start; } }
.product-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex: none; background: #f1f5f9; }
.product-thumb-empty { display: grid; place-items: center; color: #94a3b8; font-size: 10px; }

.attachment-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 9px; margin-bottom: 10px; }
.attachment-item { display: flex; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--line-2); border-radius: 9px; background: #fbfcfe; }
.attachment-item img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; flex: none; background: #f1f5f9; }
.attachment-name { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attachment-upload label.btn input { display: none; }
.attachment-upload .hint { flex-basis: 100%; }

.pe-form { max-width: 1520px; }

.pe-topbar {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
    padding: 18px 20px; margin-bottom: 16px; border: 1px solid #dbe7fb; border-radius: 14px;
    background: linear-gradient(120deg, #fff 0%, #f5f9ff 58%, #eef5ff 100%);
    box-shadow: 0 12px 32px -26px rgba(15, 23, 42, .35);
}
.pe-eyebrow { display: inline-block; font-size: 9px; letter-spacing: .2em; font-weight: 700; color: var(--primary); margin-bottom: 5px; }
.pe-title h2 { font-size: 20px; letter-spacing: -.02em; margin: 0 0 5px; }
.pe-title p { font-size: 12px; color: var(--muted); }
.pe-top-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.pe-layout { display: grid; grid-template-columns: 262px minmax(0, 1fr); gap: 16px; align-items: start; }
.pe-sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 12px; }
.pe-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pe-card { background: var(--card); border: 1px solid var(--glass-border); border-radius: 14px; box-shadow: var(--glass-shadow); backdrop-filter: saturate(1.45) blur(20px); -webkit-backdrop-filter: saturate(1.45) blur(20px); overflow: hidden; }
.pe-card-head { display: flex; align-items: center; gap: 8px; padding: 12px 15px; border-bottom: 1px solid var(--line-2); font-size: 13px; font-weight: 700; color: var(--ink); }
.pe-card-head small { font-size: 11px; font-weight: 400; color: var(--muted); flex: 1; }
.pe-card-head .btn { margin-left: auto; }
.pe-card-body { padding: 13px 15px; }

.pe-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; font-size: 11.5px; color: var(--muted); }
.pe-field:last-child { margin-bottom: 0; }
.pe-field input, .pe-field select { width: 100%; min-height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; background: #fff; color: var(--ink); font-size: 12.5px; outline: none; }
.pe-field input:focus, .pe-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.pe-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.pe-vars-card .pe-card-body { max-height: 560px; overflow: auto; }
.pe-var-search { width: 100%; height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font-size: 12px; outline: none; }
.pe-var-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.pe-var-group { margin-top: 14px; }
.pe-var-title { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #94a3b8; margin-bottom: 6px; }
.pe-var-list { display: flex; flex-direction: column; gap: 5px; }
.pe-var { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 8px; background: #f8fafc; color: #334155; font-family: Consolas, Monaco, monospace; font-size: 10.5px; text-align: left; cursor: pointer; transition: .15s; }
.pe-var span { font-family: inherit; font-size: 11px; color: var(--muted); white-space: nowrap; }
.pe-var:hover { border-color: var(--primary-300); background: var(--primary-50); color: var(--primary); transform: translateX(1px); }
.pe-var[hidden] { display: none !important; }
.pe-var-empty { padding: 22px 8px; text-align: center; color: #94a3b8; font-size: 12px; }

.pe-tabs { display: flex; gap: 3px; padding: 10px 14px 0; border-bottom: 1px solid var(--line-2); background: #fbfdff; }
.pe-tab { padding: 8px 13px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pe-tab:hover { color: var(--primary); }
.pe-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.pe-panel { display: none; padding: 14px 15px 0; }
.pe-panel.active { display: block; }
.pe-canvas-tip { font-size: 11.5px; color: #94a3b8; margin-bottom: 8px; }
.pe-canvas { min-height: 260px; max-height: 520px; overflow: auto; padding: 18px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; line-height: 1.8; font-size: 12.5px; outline: none; transition: .15s; }
.pe-canvas:focus { border-color: var(--primary-300); box-shadow: 0 0 0 4px var(--primary-ring); }
.pe-canvas .tpl-head { display: flex; justify-content: space-between; gap: 14px; padding: 14px; border-radius: 10px; background: #f1f5f9; border: 1px solid #e2e8f0; color: #0f172a; }
.pe-canvas .tpl-company { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.pe-canvas .tpl-line, .pe-canvas .tpl-mark small { font-size: 11px; color: #64748b; line-height: 1.7; }
.pe-canvas .tpl-mark { text-align: right; min-width: 140px; }
.pe-canvas .tpl-mark b { font-size: 16px; display: block; }
.pe-canvas .tpl-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 12px; }
.pe-canvas .tpl-kv-item { padding: 7px 9px; border: 1px dashed #dbe3ee; border-radius: 7px; background: #fbfdff; }
.pe-canvas .tpl-kv-item span { display: block; font-size: 10px; color: #94a3b8; }
.pe-canvas .tpl-kv-item b { font-size: 11.5px; color: #334155; font-weight: 600; }
.pe-canvas .tpl-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pe-canvas .tpl-note { border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px; background: #fbfdff; }
.pe-canvas .tpl-note h4 { font-size: 12px; color: var(--primary); margin-bottom: 5px; }
.pe-canvas .tpl-note p, .pe-canvas .tpl-note li { font-size: 11px; color: #64748b; line-height: 1.7; }

.pe-code { width: 100%; min-height: 230px; border: 1px solid #1e293b; border-radius: 10px; padding: 14px; background: #0f172a; color: var(--primary-100); font-family: Consolas, Monaco, monospace; font-size: 11.5px; line-height: 1.7; resize: vertical; outline: none; }
.pe-code:focus { border-color: var(--primary-400); box-shadow: 0 0 0 4px var(--primary-ring); }

.pe-options { display: flex; flex-wrap: wrap; gap: 14px 20px; padding: 14px 15px; margin-top: 14px; border-top: 1px solid var(--line-2); background: #fbfdff; }
.pe-switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12px; color: var(--text-2); }
.pe-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pe-switch-track { width: 34px; height: 19px; border-radius: 999px; background: #cbd5e1; position: relative; transition: .18s; flex: none; }
.pe-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: .18s; }
.pe-switch input:checked + .pe-switch-track { background: var(--primary); }
.pe-switch input:checked + .pe-switch-track::after { transform: translateX(15px); }
.pe-switch em { font-style: normal; }

.pe-preview-shell { padding: 14px; background: #f1f5f9; }
.pe-preview-shell iframe { display: block; width: 100%; height: 780px; border: 0; border-radius: 8px; background: #fff; box-shadow: 0 18px 50px -34px rgba(15, 23, 42, .55); }

.mono { font-family: Consolas, Monaco, monospace; }

@media (max-width: 1180px) {
    .pe-layout { grid-template-columns: 1fr; }
    .pe-sidebar { position: static; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
    .pe-vars-card .pe-card-body { max-height: 360px; }
    .pe-preview-shell iframe { height: 600px; }
}
@media (max-width: 760px) {
    .pe-topbar { flex-direction: column; align-items: stretch; }
    .pe-top-actions { justify-content: flex-end; }
    .pe-sidebar { grid-template-columns: 1fr; }
    .pe-field-row { grid-template-columns: 1fr; }
    .pe-preview-shell iframe { height: 460px; }
}

/* ---------------- 平板 ---------------- */
@media (max-width: 1199px) {
    .content { padding: 18px 18px 36px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------- 手机 ---------------- */
.mobile-dock { display: none; }
@media (max-width: 991px) {
    .sidebar {
        inset: 0 auto 0 0;
        border-radius: 0 18px 18px 0;
        transform: translateX(-100%);
        box-shadow: none;
        visibility: hidden;
        transition: transform .25s cubic-bezier(.2, .8, .3, 1), visibility .25s;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
        visibility: visible;
        box-shadow: 20px 0 60px rgba(15, 23, 42, .25);
    }
    .drawer-mask { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .48); z-index: 55; }
    body.sidebar-open .drawer-mask { display: block; }
    .main { margin-left: 0; padding-bottom: 78px; }
    .sidebar-toggle { display: inline-flex !important; }
    .topbar { margin: 12px 12px 0; width: calc(100% - 24px); padding: 0 14px; height: 58px; border-radius: 16px; }
    .page-heading h1 { font-size: 16px; }
    .page-heading p { display: none; }
    .quick-add span { display: none; }
    .quick-add { padding: 0; width: 38px; }
    .user-meta { display: none; }
    .user-trigger .chevron { display: none; }

    /* 底部快捷导航栏 */
    .mobile-dock {
        display: flex;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        z-index: 50;
        height: 60px;
        gap: 4px;
        padding: 6px;
        border-radius: 18px;
        background: rgba(255, 255, 255, .78);
        backdrop-filter: saturate(1.5) blur(20px);
        -webkit-backdrop-filter: saturate(1.5) blur(20px);
        border: 1px solid rgba(255, 255, 255, .66);
        box-shadow: 0 14px 34px -22px rgba(15, 23, 42, .55);
    }
    .dock-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: 0;
        background: transparent;
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 500;
        border-radius: 12px;
        cursor: pointer;
        text-decoration: none;
        transition: background .18s ease, color .18s ease, transform .12s ease;
    }
    .dock-item svg { width: 21px; height: 21px; }
    .dock-item.active { color: var(--primary); background: var(--primary-50); font-weight: 650; }
    .dock-item:active { transform: scale(.94); }
}

@media (max-width: 767px) {
    body { font-size: 13.5px; }
    .content { padding: 12px 12px 96px; }
    .topbar { height: 54px; }
    .stat-grid { gap: 9px; }
    .stat { padding: 12px 13px; border-radius: 12px; }
    .stat-value { font-size: 19px; }
    .stat-label { font-size: 11.5px; }
    .stat-ico { width: 30px; height: 30px; border-radius: 8px; }
    .stat-sub { font-size: 11px; }
    .card { border-radius: 12px; margin-bottom: 12px; }
    .card-head { padding: 12px 14px; }
    .card-body { padding: 13px 14px; }
    .filter-card { padding: 12px; border-radius: 12px; }
    .filter-form { grid-template-columns: 1fr; gap: 9px; }
    .filter-form .filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .filter-form .filter-actions .btn { width: 100%; }
    .filter-toggle {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        border: 0;
        background: transparent;
        color: var(--primary);
        font-size: 12.5px;
        font-weight: 600;
        padding: 2px 2px 10px;
        cursor: pointer;
    }
    .filter-toggle svg { width: 15px; height: 15px; transition: transform .2s; }
    .filter-card.expanded .filter-toggle svg { transform: rotate(180deg); }
    .filter-card:not(.expanded) .filter-form > div:not(:first-child):not(.filter-actions) { display: none; }
    .filter-card:not(.expanded) .filter-form .filter-actions { grid-column: 1 / -1; }
    .steps .step { min-width: 0; flex: 1; font-size: 10.5px; }
    .steps .step .dot { width: 22px; height: 22px; font-size: 10px; }
    .steps .step::after { top: 10px; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-group.span-2 { grid-column: auto; }
    .form-section { padding: 16px 14px; }
    .form-actions { padding: 12px 14px; }
    .form-actions .btn { flex: 1; min-height: 44px; }
    .form-actions .spacer { display: none; }
    .btn { min-height: 42px; }
    .btn-sm { min-height: 36px; }
    .btn-xs { min-height: 32px; }
    .icon-btn { width: 42px; height: 42px; }
    .detail-hero { padding: 18px 16px; border-radius: 12px; }
    .detail-hero h2 { font-size: 17px; }
    .detail-hero .hero-amount { font-size: 22px; }
    .detail-hero .hero-meta { gap: 14px; }
    .detail-hero .hero-actions { width: 100%; justify-content: flex-start; }
    .info-list { grid-template-columns: 1fr; }
    .info-list .item:nth-last-child(-n+2) { border-bottom: 1px dashed var(--line-2); }
    .info-list .item:last-child { border-bottom: 0; }
    .info-list dt { width: 78px; }
    .modal { display: block; visibility: hidden; pointer-events: none; }
    .modal.open { visibility: visible; pointer-events: auto; }
    .modal-panel {
        position: absolute;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 88vh;
        margin: 0;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
        transition: transform .25s cubic-bezier(.2, .8, .3, 1);
        animation: none;
    }
    .modal.open .modal-panel { transform: translateY(0); }
    .modal-head { padding: 14px 16px; position: relative; }
    .modal-head::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 38px; height: 4px; border-radius: 3px; background: #e2e8f0; }
    .modal-body { padding: 15px 16px; max-height: 66vh; }
    .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .modal-foot .btn { flex: 1; min-height: 44px; }

    /* 列表卡片化 */
    .table-cards .table-wrap { overflow: visible; }
    .table-cards table.data, .grid-main .table-cards table.data { min-width: 0; display: block; }
    .table-cards thead { display: none; }
    .table-cards tbody { display: block; }
    .table-cards tr {
        display: block;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 12px;
        margin: 0 0 10px;
        padding: 5px 12px;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
    }
    .table-cards tbody tr:hover { background: #fff; }
    .table-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 7px 0;
        border-bottom: 1px dashed var(--line-2);
        text-align: right;
        font-size: 12.5px;
        min-width: 0;
    }
    .table-cards td:last-child { border-bottom: 0; }
    .table-cards td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11.5px;
        text-align: left;
        flex: none;
        font-weight: 400;
    }
    .table-cards td:empty { display: none; }
    .table-cards td .cell-title { font-size: 13.5px; text-align: right; }
    .table-cards td[data-label=""]::before, .table-cards td::before:empty { display: none; }
    .table-cards td.row-actions-cell { display: block; text-align: left; padding-top: 9px; }
    .table-cards td.row-actions-cell::before { display: none; }
    .table-cards .row-actions { justify-content: flex-start; gap: 6px; }
    .table-cards .row-actions .btn { min-height: 34px; padding: 4px 10px; font-size: 12px; }
    .table-card-note { display: block; font-size: 11px; color: var(--muted-2); padding: 0 2px 8px; }
    .pagination { padding: 12px 4px; }
    .pagination-info { width: 100%; text-align: center; order: 2; }
    .pager { width: 100%; justify-content: center; }
    .load-more { display: block; }
    .table-cards table.data td.num { white-space: normal; }

    /* 明细表仍可横向滚动 */
    .table-plain .table-wrap { overflow-x: auto; }
    .table-plain table.data { min-width: 680px; }

    .items-section { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
    .items-table { min-width: 700px; }
    .items-foot { justify-content: space-between; }
    .items-foot .total b { font-size: 17px; }
    .tabs { margin: 0 -14px; padding: 0 14px; }
    .tab { padding: 10px 11px; font-size: 13px; }
    .timeline { padding-left: 18px; }
    .steps .step { min-width: 0; }
    .steps .step span { font-size: 10px; }

    /* 图表：横向滑动 */
    .chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .chart-scroll .chart { min-width: 420px; }

    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { padding: 28px 20px; min-height: 100vh; align-items: flex-start; padding-top: 12vh; }
    .auth-card { max-width: 420px; }
    .auth-card h2 { font-size: 22px; }

    .user-menu .dropdown-menu { min-width: 200px; }
    .dropdown-menu { min-width: 168px; }
    .no-mobile { display: none !important; }
    .mobile-only { display: block !important; }
}

@media (max-width: 420px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 17px; }
    .stat-value small { font-size: 10px; }
    .page-heading h1 { font-size: 15px; }
}

/* ---------------- 打印 ---------------- */
@media print {
    .sidebar, .topbar, .drawer-mask, .no-print, .alert, .form-actions, .pagination, .filter-card { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; max-width: none; }
    body { background: #fff; }
    .card { background: #fff !important; box-shadow: none; border: 1px solid #cbd5e1; break-inside: avoid; }
    a { color: inherit; }
    .table-wrap { overflow: visible; }
    table.data { min-width: 0; font-size: 11px; }
    table.data th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; }
    @page { size: A4; margin: 12mm; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .card, .stat, .filter-card, .form-card, .pe-card { background: rgba(255, 255, 255, .92); }
    .sidebar { background: rgba(10, 26, 44, .94); }
}
