:root {
    --bg:           #f6f7f9;
    --surface:      #ffffff;
    --surface-2:    #fafbfc;
    --border:       #e4e7ec;
    --text:         #1a1d23;
    --text-secondary: #6b7280;
    --primary:      #5b5bd6;
    --primary-soft: #ececfb;
    --success:      #0e9f6e;
    --warning:      #d97706;
    --danger:       #dc2626;
    --sidebar-bg:   #171922;
    --sidebar-text: #a7adbb;
    --radius:       10px;
}

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

body {
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ───── 侧边栏 ───── */
.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 0;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 18px 14px; flex-shrink: 0; }

/* 导航区自己滚：窗口再矮，顶上的 logo 和底下的用户信息都不会被挤掉 */
.nav-scroll {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #3a3f4d transparent;
}
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-thumb { background: #3a3f4d; border-radius: 3px; }
.nav-scroll::-webkit-scrollbar-track { background: transparent; }
/* 滚到底之前在底部压一层渐隐，提示下面还有东西 */
.nav-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.nav-wrap::after {
    content: ''; position: absolute; left: 0; right: 6px; bottom: 0; height: 22px;
    background: linear-gradient(to bottom, transparent, var(--sidebar-bg));
    pointer-events: none; opacity: 0; transition: opacity .15s;
}
.nav-wrap.has-more::after { opacity: 1; }
.logo-icon { font-size: 24px; }
.logo-text { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.2; }
.logo-text small { font-weight: 400; font-size: 11px; color: var(--sidebar-text); letter-spacing: .5px; }

.nav-group {
    padding: 11px 18px 5px;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #5c6373;
    display: flex; align-items: center; gap: 6px;
}
.nav-group.clickable-group { cursor: pointer; user-select: none; }
.nav-group.clickable-group:hover { color: #9aa2b4; }
.nav-group.clickable-group::after {
    content: '▾'; font-size: 9px; margin-left: auto; opacity: .55;
    transition: transform .15s;
}
.nav-group.clickable-group.collapsed::after { transform: rotate(-90deg); }
.nav-menu { list-style: none; }
.nav-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 18px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.nav-menu a:hover { background: #20232e; color: #fff; }
.nav-menu a.active { background: #20232e; color: #fff; border-left-color: var(--primary); }
.nav-menu a.dimmed { opacity: .5; }
.nav-icon { width: 18px; text-align: center; }
.nav-badge {
    margin-left: auto;
    background: var(--danger); color: #fff;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; font-size: 11px;
    display: inline-flex; align-items: center; justify-content: center;
}
.phase-tag {
    margin-left: auto; font-size: 10px;
    background: #2b2f3c; padding: 2px 6px; border-radius: 4px;
}
.nav-footer {
    flex-shrink: 0;
    margin-top: 0;
    padding: 12px 18px 0;
    border-top: 1px solid #262a36;
    background: var(--sidebar-bg);
}
.nav-footer small { font-size: 11px; color: #5c6373; }
.user-chip { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; color: #cfd4de; }
.avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
}

/* ───── 主区 ───── */
.main-content { flex: 1; padding: 26px 30px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 650; }
.page-head .sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.head-actions { display: flex; gap: 8px; }

/* ───── 卡片与网格 ───── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.mt { margin-top: 14px; }

.stat .label { font-size: 12px; color: var(--text-secondary); }
.stat .value { font-size: 25px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.stat .foot { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat.accent .value { color: var(--primary); }
.stat.warn   .value { color: var(--warning); }
.stat.danger .value { color: var(--danger); }
.stat.good   .value { color: var(--success); }

/* ───── 表格 ───── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    text-align: left; font-weight: 600; font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--text-secondary); }
.empty { padding: 28px; text-align: center; color: var(--text-secondary); }

/* ───── 徽标 ───── */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; line-height: 1.7; white-space: nowrap;
    background: #eef0f3; color: #4b5563;
}
.tag-green  { background: #e3f6ee; color: #067a52; }
.tag-amber  { background: #fdf0dd; color: #a35c06; }
.tag-red    { background: #fde8e8; color: #b91c1c; }
.tag-blue   { background: var(--primary-soft); color: #4745b8; }
.tag-grey   { background: #eef0f3; color: #6b7280; }
.cny { font-size: 11px; color: var(--text-secondary); }

/* ───── 按钮与表单 ───── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: 13px; cursor: pointer; text-decoration: none;
    font-family: inherit;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--primary); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-danger { color: var(--danger); border-color: #f3c6c6; }

input, select, textarea {
    width: 100%; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: 7px;
    font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin-bottom: 0; min-width: 130px; }

/* ───── 模态框 ───── */
.modal {
    display: none; position: fixed; inset: 0;
    background: rgba(17,19,26,.45); z-index: 100;
    align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal.open { display: flex; }
.modal-content {
    background: var(--surface); border-radius: 12px;
    width: 100%; max-width: 680px;
    box-shadow: 0 16px 48px rgba(0,0,0,.2);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.close-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary); width: auto; }

/* ───── 换算提示条 ───── */
.fx-hint {
    background: var(--primary-soft); color: #3f3dab;
    padding: 9px 12px; border-radius: 7px; font-size: 13px; margin-bottom: 12px;
}
.fx-hint strong { font-variant-numeric: tabular-nums; }

/* ───── Toast ───── */
#toastHost { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: #22262f; color: #fff; padding: 10px 16px;
    border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast-error { background: var(--danger); }

/* ───── 平台卡 ───── */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.acct-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; border-top: 3px solid var(--primary); }
.acct-card .plat { font-weight: 650; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.acct-card .meta { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.acct-card .acts { margin-top: 12px; display: flex; gap: 6px; }

/* ───── 占位页 ───── */
.placeholder { max-width: 560px; margin: 60px auto; text-align: center; }
.placeholder .big { font-size: 46px; }
.placeholder h2 { margin: 12px 0 6px; font-size: 20px; }
.placeholder ul { text-align: left; margin-top: 18px; list-style: none; }
.placeholder li { padding: 8px 0 8px 22px; position: relative; border-bottom: 1px solid var(--border); font-size: 13px; }
.placeholder li::before { content: "→"; position: absolute; left: 0; color: var(--primary); }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1115; --surface: #171a21; --surface-2: #1c2029;
        --border: #272c38; --text: #e6e8ec; --text-secondary: #949cab;
        --primary-soft: #23223f;
    }
}

/* ───── 弹窗 tab ───── */
.tabs { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--border); }
.tabs .tab {
    background: none; border: none; border-bottom: 2px solid transparent;
    padding: 8px 16px; font-size: 14px; font-family: inherit;
    color: var(--text-secondary); cursor: pointer; width: auto;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ───── 可点击的统计卡 ───── */
a.card.clickable { text-decoration: none; color: inherit; display: block; transition: border-color .12s, transform .12s; }
a.card.clickable:hover { border-color: var(--primary); transform: translateY(-1px); }

/* ───── 表内迷你下拉 ───── */
select.mini { width: auto; padding: 2px 4px; font-size: 11px; }

/* ───── 行内勾选 ───── */
label.chk { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; cursor: pointer; }
label.chk input { width: auto; }
.chk-row { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.chk-row label.chk { margin-top: 0; }

/* 键值对资料表 */
table.kv { width: 100%; font-size: 13px; }
table.kv td { padding: 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
table.kv tr:last-child td { border-bottom: none; }
table.kv td:first-child { width: 90px; white-space: nowrap; padding-right: 10px; }

/* 整行可点击跳转的表格行 */
tr.row-link { cursor: pointer; }
tr.row-link:hover > td { background: var(--surface-2); }
tr.row-link.dl-over:hover > td { background: #fde8e8; }
tr.row-link.dl-soon:hover > td { background: #fef3c7; }
/* 行内的按钮、链接、下拉不应该触发跳转 */
tr.row-link .no-nav { cursor: default; }

/* 产权登记的四个分页签（.tabs 原本是弹窗里的，这里是 <a> 版） */
.tabs a.tab { text-decoration: none; }
.tab-n {
    margin-left: 5px; font-size: 11px; opacity: .7;
    background: rgba(0,0,0,.07); padding: 1px 6px; border-radius: 8px;
}
.tab.active .tab-n { background: rgba(91,91,214,.14); color: var(--primary); }
/* 带撤销按钮的 toast */
.toast.toast-undo {
    display: flex; align-items: center; gap: 12px;
    background: #1f2430; color: #f3f4f6;
}
.toast.toast-undo button {
    background: none; border: 1px solid #4b5563; color: #c7d2fe;
    padding: 3px 11px; border-radius: 6px; font-size: 12px;
    cursor: pointer; font-family: inherit; width: auto; flex: none;
}
.toast.toast-undo button:hover { border-color: var(--primary); color: #fff; }
.toast.toast-undo button:disabled { opacity: .5; cursor: default; }

/* 产权详情页的图片缩略图 */
.thumb-grid {
    display: grid; gap: 12px; margin-top: 10px;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.thumb { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-2); }
.thumb img { display: block; width: 100%; height: 132px; object-fit: cover; background: #fff; }
.thumb figcaption {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 8px; font-size: 11px; background: var(--surface);
}
.thumb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }

/* 权限表里的内联小输入框 */
.mini-input {
    width: 100%; min-width: 170px; padding: 4px 7px; font-size: 12px;
    border: 1px solid var(--border); border-radius: 5px; font-family: inherit;
}
.mini-input:focus { border-color: var(--primary); outline: none; }

.tabs.page-tabs {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px 10px 0 0; padding: 4px 8px 0; flex-wrap: wrap;
}

/* 发现 / 卡点 / 建议：整条按状态标色 */
.fd-row td { transition: background .15s; }
.fd-row.st-todo  td { background: #fffbeb; }
.fd-row.st-sched td { background: #eff6ff; }
.fd-row.st-fixed td { background: #f0fdf4; }
.fd-row.st-skip  td { background: var(--surface-2); }
.fd-row.st-todo  td:first-child { box-shadow: inset 3px 0 0 #d97706; }
.fd-row.st-sched td:first-child { box-shadow: inset 3px 0 0 #2563eb; }
.fd-row.st-fixed td:first-child { box-shadow: inset 3px 0 0 #0e9f6e; }
.fd-row.st-skip  td:first-child { box-shadow: inset 3px 0 0 #9ca3af; }
/* 已修复 / 不做的往后退一步，视觉上让没处理的跳出来 */
.fd-row.st-fixed td, .fd-row.st-skip td { opacity: .62; }
.fd-row.st-fixed:hover td, .fd-row.st-skip:hover td { opacity: 1; }

/* 期限提醒：逾期红、快到期黄、办完的淡掉 */
.dl-row.dl-over td { background: #fef2f2; }
.dl-row.dl-soon td { background: #fffbeb; }
.dl-row.dl-done td { opacity: .5; }
.dl-row.dl-done:hover td { opacity: 1; }
.dl-row.dl-over td:first-child { box-shadow: inset 3px 0 0 #dc2626; }
.dl-row.dl-soon td:first-child { box-shadow: inset 3px 0 0 #d97706; }

/* 可折叠分块（已取消的订阅等） */
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: '▸ '; color: var(--muted); }
details.card[open] > summary::before { content: '▾ '; }
details.card > summary:hover { color: var(--primary); }

/* ───── 互动时间线 ───── */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
    content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
    width: 2px; background: var(--border);
}
.tl-item { position: relative; padding: 10px 0 14px; }
.tl-dot {
    position: absolute; left: -20px; top: 16px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--surface);
}
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-date { font-weight: 600; font-size: 13px; }
.tl-acts { margin-left: auto; display: flex; gap: 5px; }
.tl-sum { margin-top: 6px; font-size: 13px; white-space: pre-wrap; }
.tl-next {
    margin-top: 6px; font-size: 12px; color: var(--primary);
    background: var(--primary-soft); display: inline-block;
    padding: 3px 9px; border-radius: 6px;
}

/* ───── 排序链接 ───── */
.active-sort { font-weight: 600; color: var(--primary); }

/* ───── 发布日历 ───── */
.filterbar { padding: 12px 16px; margin-bottom: 14px; }
.fb-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fb-row + .fb-row { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--border); }
.fb-label { font-size: 12px; color: var(--text-secondary); width: 34px; flex-shrink: 0; }
.fb-hint { margin-left: auto; font-size: 12px; color: var(--text-secondary); }

.chip {
    --chip: var(--primary);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 20px; width: auto;
    border: 1px solid var(--border); background: var(--surface);
    font-size: 13px; font-family: inherit; color: var(--text-secondary); cursor: pointer;
}
.chip:hover { border-color: var(--chip); color: var(--text); }
.chip.active {
    background: color-mix(in srgb, var(--chip) 14%, transparent);
    border-color: var(--chip); color: var(--chip); font-weight: 600;
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip); }

.cal-head {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    font-size: 12px; font-weight: 600; color: var(--text-secondary); text-align: center;
    padding: 2px 0 8px;
}
.cal-grid {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px; background: var(--border);
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.cal-cell {
    background: var(--surface); min-height: 112px; padding: 5px 6px 7px;
    display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-daynum { opacity: .4; }
.cal-cell.is-today { background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.cal-daynum { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.cal-cell.is-today .cal-daynum span:first-child {
    font-weight: 700; color: #fff; background: var(--primary);
    width: 21px; height: 21px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.cal-add {
    opacity: 0; border: none; background: none; cursor: pointer; width: auto;
    font-size: 15px; line-height: 1; color: var(--text-secondary); padding: 0 2px;
}
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { color: var(--primary); }

.cal-chip {
    font-size: 11px; line-height: 1.3; padding: 4px 6px 4px 8px;
    border-radius: 4px; cursor: pointer; min-width: 0;
    background: color-mix(in srgb, var(--chip) 11%, transparent);
    border-left: 3px solid var(--chip);
}
.cal-chip:hover { background: color-mix(in srgb, var(--chip) 22%, transparent); }
.cal-plat { display: block; color: var(--chip); font-weight: 600; font-size: 10px; }
.cal-title { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.done { opacity: .55; }
.cal-chip.done .cal-title::after { content: " ✓"; color: var(--success); }
.cal-chip.cancelled { opacity: .4; }
.cal-chip.cancelled .cal-title { text-decoration: line-through; }

@media (max-width: 900px) {
    .cal-cell { min-height: 76px; }
    .cal-title { font-size: 10px; }
}


/* ───── 进度条 ───── */
.bar { height: 5px; background: var(--border); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .25s; }

/* ───── 勾选列表（邀请玩家） ───── */
.pick-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.pick-row {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 12px; font-size: 13px; cursor: pointer; margin: 0;
    border-bottom: 1px solid var(--border);
}
.pick-row:last-child { border-bottom: none; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { width: auto; }

/* ───── 单据上传区 ───── */
.upload-zone {
    margin-top: 14px; padding: 13px 14px;
    border: 1px dashed var(--border); border-radius: 9px;
    background: var(--surface-2);
}
.att-queue { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.att-row {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 5px 8px; font-size: 12px;
}
.att-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-up-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.att-up-row select.att-kind { width: 150px; flex: none; }
.att-up-row input.att-file { flex: 1; min-width: 0; font-size: 12px; }
.att-up-row .btn-danger { flex: none; padding: 4px 9px; line-height: 1; }

