:root {
    --brand: #1f7a4d;
    --brand-dark: #155c39;
    --brand-light: #e9f5ee;
    --accent: #34a76a;
    --accent-soft: #d8f0e2;
    --bg: #f3f6f4;
    --surface: #ffffff;
    --surface-2: #f8faf9;
    --line: #e6ece9;
    --line-strong: #d8e2dd;
    --text: #16241d;
    --muted: #6c7d74;
    --danger: #d4452f;
    --danger-bg: #fdecea;
    --warn: #c0811a;
    --warn-bg: #fdf4e1;
    --info: #2f6fb0;
    --info-bg: #eaf2fb;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(20, 45, 32, .05), 0 2px 8px rgba(20, 45, 32, .04);
    --shadow: 0 1px 2px rgba(20, 45, 32, .06), 0 10px 30px rgba(20, 45, 32, .06);
    --shadow-lg: 0 12px 40px rgba(18, 50, 34, .12);
    --ring: 0 0 0 4px rgba(52, 167, 106, .16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

::selection { background: var(--accent-soft); }

.mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 244px;
    flex: 0 0 244px;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(52, 167, 106, .22) 0%, transparent 55%),
        linear-gradient(180deg, #15482f 0%, #0f3823 100%);
    color: #d7e7dd;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 4px 0 24px rgba(10, 30, 20, .12);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 11px;
    background: linear-gradient(145deg, #43c389, #1f7a4d);
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
    box-shadow: 0 6px 16px rgba(31, 122, 77, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-name { color: #fff; font-weight: 700; font-size: 15.5px; letter-spacing: .02em; }
.brand-sub { color: #8fb8a3; font-size: 11px; letter-spacing: .04em; }

.nav {
    display: flex; flex-direction: column; gap: 2px; margin-top: 6px;
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 3px;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 3px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav-group { display: flex; flex-direction: column; }
.nav-group-title {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; background: transparent; border: 0; cursor: pointer;
    color: #84b39c; font-size: 11px; letter-spacing: .1em; font-weight: 600;
    padding: 16px 11px 7px; text-align: left; font-family: inherit;
    text-transform: uppercase; transition: color .15s;
}
.nav-group-title:hover { color: #d6ecdf; }
.nav-group-title .caret { display: inline-block; transition: transform .2s ease; font-style: normal; font-size: 13px; line-height: 1; opacity: .8; }
.nav-group.open > .nav-group-title .caret { transform: rotate(90deg); }
.nav-group-items { display: none; flex-direction: column; gap: 2px; }
.nav-group.open > .nav-group-items { display: flex; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; border-radius: 9px; color: #cfe3d8; font-size: 13.5px;
    text-decoration: none; transition: background .15s, color .15s, transform .1s;
    position: relative; border: 1px solid transparent;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav a.active {
    background: linear-gradient(90deg, rgba(52, 167, 106, .26), rgba(52, 167, 106, .1));
    color: #fff; font-weight: 600; border-color: rgba(52, 167, 106, .32);
}
.nav a.active::before {
    content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: #5fd99a;
    box-shadow: 0 0 8px rgba(95, 217, 154, .8);
}
.nav a .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; flex: 0 0 6px; }
.nav a.active .dot { opacity: 1; background: #5fd99a; }
.sidebar-foot {
    margin-top: auto; padding: 13px 11px 0; border-top: 1px solid rgba(255, 255, 255, .1);
    color: #8fb8a3; font-size: 11.5px; letter-spacing: .02em;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 62px; background: rgba(255, 255, 255, .82); backdrop-filter: saturate(1.5) blur(10px);
    -webkit-backdrop-filter: saturate(1.5) blur(10px);
    border-bottom: 1px solid var(--line); display: flex; align-items: center;
    justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.side-toggle {
    display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
    background: #fff; color: var(--brand); font-size: 18px; cursor: pointer; align-items: center; justify-content: center;
    margin-right: 10px; transition: background .15s;
}
.side-toggle:hover { background: var(--brand-light); }
.side-backdrop { display: none; }

.crumb { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.crumb strong { color: var(--text); font-weight: 600; }
.crumb { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.crumb strong { color: var(--text); font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(145deg, #43c389, #1f7a4d);
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
    box-shadow: 0 2px 8px rgba(31, 122, 77, .3);
}

.content { padding: 26px 28px; max-width: 1360px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 23px; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.tenant-picker { display: flex; align-items: center; gap: 8px; }
.tenant-picker label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tenant-picker .input { width: auto; min-width: 210px; }
.actions { display: flex; gap: 9px; align-items: center; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px 22px; transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.card + .card { margin-top: 18px; }
.card-title {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
    font-weight: 700; font-size: 15px; position: relative;
}
.card-title::before {
    content: ''; width: 4px; height: 15px; border-radius: 3px;
    background: linear-gradient(180deg, var(--accent), var(--brand)); margin-right: 10px;
}
.card-title .extra { font-weight: 400; color: var(--muted); font-size: 12.5px; }

.grid { display: grid; gap: 18px; }
.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)); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat::after {
    content: ''; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px;
    border-radius: 50%; background: radial-gradient(circle, rgba(52, 167, 106, .1) 0%, transparent 70%);
    pointer-events: none;
}
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-icon {
    position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center; font-size: 19px; background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(52, 167, 106, .12);
}
.stat.brand {
    background: linear-gradient(155deg, #1f7a4d, #2b9b61 70%, #34a76a);
    border: 0; color: #fff; box-shadow: 0 12px 30px rgba(31, 122, 77, .35);
}
.stat.brand .label, .stat.brand .hint { color: rgba(255, 255, 255, .82); }
.stat.brand::after { background: radial-gradient(circle, rgba(255, 255, 255, .22) 0%, transparent 70%); }
.stat.brand .stat-icon { background: rgba(255, 255, 255, .18); box-shadow: none; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
    padding: 12px 14px; border-bottom: 1px solid var(--line-strong);
    background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: var(--accent-soft); }
.table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3.5px 10px;
    border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5;
    border: 1px solid transparent;
}
.badge-success { background: var(--accent-soft); color: var(--brand-dark); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: #eef1ef; color: var(--muted); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-solid-success { background: var(--brand); color: #fff; }
.badge-solid-danger { background: var(--danger); color: #fff; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line);
    background: #fff; color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: .15s; white-space: nowrap; font-family: inherit;
    box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: #cdd8d2; background: #f7faf8; text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(180deg, #2b9b61, #1f7a4d); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(31, 122, 77, .32); }
.btn-primary:hover { background: linear-gradient(180deg, #34a76a, #1f7a4d); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--brand-light); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 7px; color: #34433b; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.input, .select, .textarea {
    width: 100%; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 10px;
    background: #fff; font-size: 13.5px; font-family: inherit; color: var(--text); transition: .15s;
    box-shadow: inset 0 1px 2px rgba(20, 45, 32, .03);
}
.input::placeholder, .textarea::placeholder { color: #a9b6b0; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.textarea { min-height: 96px; resize: vertical; font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.alert {
    border-radius: 11px; padding: 12px 15px; font-size: 13px; margin-bottom: 16px;
    border: 1px solid transparent; position: relative; padding-left: 16px;
    border-left-width: 4px;
}
.alert-success { background: var(--accent-soft); border-color: #c6e6d4; border-left-color: var(--brand); color: #14532d; }
.alert-danger { background: var(--danger-bg); border-color: #f5c6c0; border-left-color: var(--danger); color: #7f2318; }
.alert-warn { background: var(--warn-bg); border-color: #f1ddb4; border-left-color: var(--warn); color: #7a5310; }
.alert-info { background: var(--info-bg); border-color: #d4e3f5; border-left-color: var(--info); color: #1e4a7a; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; margin: 4px 0 0; padding-left: 0; list-style: none; }
.tl-item { position: relative; padding: 0 0 22px 36px; }
.tl-item::before {
    content: ''; position: absolute; left: 10px; top: 6px; width: 12px; height: 12px;
    border-radius: 50%; background: #fff; border: 3px solid var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.tl-item::after { content: ''; position: absolute; left: 15px; top: 22px; bottom: 0; width: 2px; background: #dbe6df; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::after { display: none; }
.tl-item.private::before { border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.tl-time { color: var(--muted); font-size: 12px; }
.tl-head { display: flex; align-items: center; gap: 8px; margin: 3px 0 2px; flex-wrap: wrap; }
.tl-head strong { font-size: 14.5px; }
.tl-meta { color: var(--muted); font-size: 12.5px; }
.tl-hash {
    margin-top: 6px; background: var(--surface-2); border: 1px dashed #d9e5dd; border-radius: 8px;
    padding: 6px 10px; color: #4b5b53; font-size: 11.5px; word-break: break-all;
}
.tl-payload { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f2f6f4; border: 1px solid #e2ebe6; border-radius: 7px; padding: 3px 9px; font-size: 12px; color: #3d5147; }

/* ---------- 键值网格 ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px 20px; }
.kv-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { font-weight: 700; font-size: 14px; margin-top: 3px; word-break: break-all; }

.hero-code {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px;
    font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; overflow-x: auto; white-space: pre;
}

.empty {
    text-align: center; color: var(--muted); padding: 44px 12px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.empty::before {
    content: ''; width: 46px; height: 46px; border-radius: 14px; margin-bottom: 4px;
    background:
        linear-gradient(45deg, transparent 46%, var(--line-strong) 46%, var(--line-strong) 54%, transparent 54%) center / 22px 22px no-repeat,
        var(--surface-2);
    border: 1px solid var(--line); display: block;
}

/* ---------- 分页 ---------- */
.pager { margin-top: 18px; }
.pager nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pager a, .pager span {
    padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
    font-size: 13px; color: var(--text); text-decoration: none; transition: .15s; min-width: 36px; text-align: center;
}
.pager a:hover { border-color: var(--accent); color: var(--brand); background: var(--accent-soft); text-decoration: none; }
.pager .active span, .pager span[aria-current] { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(31, 122, 77, .3); }

/* ---------- 公开页 ---------- */
.public-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.public-head {
    background: linear-gradient(160deg, #13492f 0%, #1f7a4d 55%, #34a76a 120%);
    color: #fff; padding: 22px 0 46px;
}
.public-head .inner { max-width: 760px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.public-brand { display: flex; align-items: center; gap: 10px; }
.public-brand .mark {
    width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .16);
    display: grid; place-items: center; font-weight: 800;
}
.public-brand .t { font-weight: 700; font-size: 16px; letter-spacing: .04em; }
.public-brand .s { font-size: 11.5px; color: rgba(255, 255, 255, .7); }
.public-body { margin-top: -32px; }
.public-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; line-height: 1.8; }

.search-hero { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 16px 44px rgba(20, 60, 40, .12); }
.search-row { display: flex; gap: 10px; }
.search-row .input { flex: 1; padding: 13px 15px; font-size: 15px; }

.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.result-head h2 { font-size: 21px; }
.result-head .no { color: var(--muted); font-size: 13px; margin-top: 3px; }

.chain-banner { border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; border: 1px solid transparent; }
.chain-banner.ok { background: var(--accent-soft); color: #14532d; border-color: #c6e6d4; }
.chain-banner.bad { background: var(--danger-bg); color: #7f2318; border-color: #f5c6c0; }
.chain-banner .icon { font-size: 18px; line-height: 1.2; }
.chain-banner .t { font-weight: 700; font-size: 14px; }
.chain-banner .d { font-size: 12.5px; opacity: .85; margin-top: 2px; }

.sample-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.sample-tag { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--muted); background: #fbfdfc; cursor: pointer; transition: .15s; }
.sample-tag:hover { border-color: var(--accent); color: var(--brand); background: var(--accent-soft); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, #dff0e6 0%, transparent 60%), var(--bg); }
.login-card {
    width: 100%; max-width: 408px; background: #fff; border: 1px solid var(--line);
    border-radius: 18px; padding: 32px 30px 30px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.login-card::before {
    content: ''; position: absolute; left: 0; top: 0; right: 0; height: 5px;
    background: linear-gradient(90deg, #2b9b61, #1f7a4d, #34a76a);
}

@media (max-width: 1100px) {
    .split { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .side-toggle { display: inline-flex; }
    .side-backdrop {
        display: block; position: fixed; inset: 0; z-index: 55; background: rgba(12, 28, 18, .5);
        opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    .side-backdrop.show { opacity: 1; pointer-events: auto; }
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 60; width: 264px; flex-basis: 264px;
        transform: translateX(-100%); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    }
    .sidebar.open { transform: translateX(0); }
    .content { padding: 18px 16px; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .row-2 { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .result-head { flex-direction: column; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .page-head .actions { width: 100%; flex-wrap: wrap; }
}
@media (max-width: 520px) {
    .kv { grid-template-columns: 1fr 1fr; }
    .search-row { flex-direction: column; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* 产品缩略图（商品相关列表通用） */
.cell-product { display: flex; align-items: center; gap: 9px; }
.thumb {
    width: 36px; height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 36px;
    background: #eef2f0;
    border: 1px solid #e3e8e5;
    box-shadow: var(--shadow-sm);
}
.thumb-lg { width: 68px; height: 68px; flex-basis: 68px; border-radius: 10px; }
.thumb-empty {
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: #94a3b8;
    border: 1px dashed #cbd5d1;
}
