:root {
    --brand: #1f6f43;
    --brand-dark: #145031;
    --brand-light: #e8f3ec;
    --accent: #2f9e63;
    --bg: #f4f7f5;
    --surface: #ffffff;
    --line: #e2e8e4;
    --text: #1a2320;
    --muted: #6b7a72;
    --danger: #c0392b;
    --danger-bg: #fdecea;
    --warn: #b7791f;
    --warn-bg: #fdf6e3;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(26, 35, 32, .06), 0 8px 24px rgba(26, 35, 32, .04);
}

* { box-sizing: border-box; }

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;
}

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

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

.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: 232px;
    flex: 0 0 232px;
    background: linear-gradient(180deg, #14472e 0%, #0f3722 100%);
    color: #d7e7dd;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(145deg, #39b477, #1f6f43);
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.brand-sub { color: #8fb8a3; font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-label { font-size: 11px; color: #7ea691; padding: 14px 10px 6px; letter-spacing: .08em; }
.nav a {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 10px; border-radius: 8px; color: #cfe3d8; font-size: 13.5px;
    text-decoration: none; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(83, 201, 141, .18); color: #fff; font-weight: 600; }
.nav a .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, .09); color: #8fb8a3; font-size: 12px; }

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

.topbar {
    height: 60px; background: rgba(255, 255, 255, .9); backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--line); display: flex; align-items: center;
    justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.crumb { color: var(--muted); font-size: 13px; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--brand-light); color: var(--brand);
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

.content { padding: 24px; max-width: 1320px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.actions { display: flex; gap: 8px; align-items: center; }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-weight: 650; }
.card-title .extra { font-weight: 400; color: var(--muted); font-size: 12px; }

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

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.brand { background: linear-gradient(160deg, #1f6f43, #2b8b57); border: 0; color: #fff; }
.stat.brand .label, .stat.brand .hint { color: rgba(255, 255, 255, .78); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
    padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafcfb; white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfdfc; }
.table-wrap { overflow-x: auto; }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
    border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5;
}
.badge-success { background: var(--brand-light); color: var(--brand); }
.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-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: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
    background: #fff; color: var(--text); font-size: 13px; font-weight: 550; cursor: pointer;
    text-decoration: none; transition: .15s; white-space: nowrap; font-family: inherit;
}
.btn:hover { border-color: #cfd8d3; background: #f7faf8; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 11px 20px; font-size: 15px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.input, .select, .textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
    background: #fff; font-size: 13.5px; font-family: inherit; color: var(--text); transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 158, 99, .12); }
.textarea { min-height: 92px; resize: vertical; font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.alert { border-radius: 10px; padding: 11px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--brand-light); border-color: #cbe6d6; color: #14532d; }
.alert-danger { background: var(--danger-bg); border-color: #f5c6c0; color: #7f2318; }
.alert-warn { background: var(--warn-bg); border-color: #f2e0b6; color: #7a5310; }
.alert-info { background: #eef4fb; border-color: #d5e3f5; 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 34px; }
.tl-item::before {
    content: ''; position: absolute; left: 9px; top: 6px; width: 11px; height: 11px;
    border-radius: 50%; background: #fff; border: 2.5px solid var(--accent);
}
.tl-item::after { content: ''; position: absolute; left: 14px; top: 21px; bottom: 0; width: 1.5px; background: #dbe6df; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::after { display: none; }
.tl-item.private::before { border-color: var(--warn); }
.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: #f7faf8; border: 1px dashed #d9e5dd; border-radius: 7px;
    padding: 5px 9px; 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: 6px; padding: 2px 8px; font-size: 12px; color: #3d5147; }

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

.hero-code {
    background: #f7faf8; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
    font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; overflow-x: auto; white-space: pre;
}

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

/* ---------- 分页 ---------- */
.pager { margin-top: 16px; }
.pager nav { display: flex; gap: 6px; }
.pager a, .pager span {
    padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
    font-size: 13px; color: var(--text); text-decoration: none;
}
.pager .active span, .pager span[aria-current] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 公开页 ---------- */
.public-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.public-head {
    background: linear-gradient(160deg, #145031 0%, #1f6f43 55%, #2f9e63 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: 16px; padding: 22px; box-shadow: 0 12px 40px rgba(20, 60, 40, .10); }
.search-row { display: flex; gap: 10px; }
.search-row .input { flex: 1; padding: 12px 14px; 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; }
.chain-banner.ok { background: var(--brand-light); color: #14532d; }
.chain-banner.bad { background: var(--danger-bg); color: #7f2318; }
.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: 4px 11px; font-size: 12px; color: var(--muted); background: #fbfdfc; cursor: pointer; }
.sample-tag:hover { border-color: var(--accent); color: var(--brand); }

.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: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: 0 18px 50px rgba(20, 60, 40, .10); }

@media (max-width: 1100px) {
    .split { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .sidebar { display: none; }
    .content { padding: 16px; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .row-2 { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .result-head { flex-direction: column; }
}
@media (max-width: 520px) {
    .kv { grid-template-columns: 1fr 1fr; }
    .search-row { flex-direction: column; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
}
