/* ============ 设计令牌 ============ */
:root {
    --brand-900: #0f2542;
    --brand-800: #16325c;
    --brand-700: #1d4076;
    --brand-600: #2456a4;
    --brand-500: #3273d1;
    --brand-100: #e4edf9;
    --accent: #c99a3c;
    --bg: #f2f5f9;
    --surface: #ffffff;
    --line: #e3e8f0;
    --text-1: #1c2b3a;
    --text-2: #5b6b7f;
    --ok: #1e8e5a;
    --warn: #b8860b;
    --danger: #c0392b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(16, 42, 83, .08), 0 8px 24px rgba(16, 42, 83, .05);
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text-1);
    margin: 0;
}

/* ============ 应用框架 ============ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-800) 100%);
    color: #cfe0f5;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1040;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 26px; color: var(--accent); }
.sidebar-brand .brand-logo { height: 40px; width: 40px; object-fit: contain; background: #fff; border-radius: 9px; padding: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.25); flex: none; }
.brand-title { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: #8fa8c9; margin-top: 2px; }

.sidebar-nav { padding: 10px 10px 24px; }
.nav-group-title {
    font-size: 11px; color: #7e97ba; padding: 14px 10px 6px;
    letter-spacing: 2px; text-transform: uppercase;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; margin: 2px 0;
    color: #cfe0f5; text-decoration: none;
    border-radius: 8px; font-size: 14px;
    transition: background .15s, color .15s;
    min-height: 44px;
}
.nav-item i { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active { background: var(--brand-500); color: #fff; }
.nav-main { font-weight: 600; }

.sidebar-backdrop { display: none; }

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

.topbar {
    height: 56px; background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 10px;
    padding: 0 18px;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; font-size: 16px; }
.user-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--brand-100); color: var(--brand-800);
    border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 500;
    white-space: nowrap;
}

.content { padding: 20px; flex: 1; }
.app-footer {
    padding: 14px 20px; color: var(--text-2); font-size: 12px;
    border-top: 1px solid var(--line); text-align: center;
}

/* ============ 按钮/图标 ============ */
.btn { border-radius: 8px; }
.btn-primary {
    background: var(--brand-600); border-color: var(--brand-600);
}
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: none; background: transparent;
    border-radius: 8px; color: var(--text-2); cursor: pointer;
    text-decoration: none; font-size: 18px;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--brand-100); color: var(--brand-800); }

/* ============ 卡片 ============ */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header {
    background: var(--surface); border-bottom: 1px solid var(--line);
    font-weight: 600; padding: 14px 18px;
}

/* ============ 表格 ============ */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.table-toolbar .toolbar-title { font-size: 17px; font-weight: 700; margin-right: auto; }
.table-responsive { overflow-x: auto; }
.table { margin: 0; font-size: 13.5px; }
.table thead th {
    background: #f7f9fc; color: var(--text-2); font-weight: 600;
    border-bottom: 1px solid var(--line); white-space: nowrap;
    padding: 10px 12px;
}
.table tbody td {
    border-bottom: 1px solid #eef1f6; padding: 10px 12px;
    vertical-align: middle; color: var(--text-1);
}
.table tbody tr:hover { background: #f6f9fd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ 状态徽章 ============ */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-green { background: #e3f4ec; color: #14713f; }
.badge-blue { background: var(--brand-100); color: var(--brand-700); }
.badge-gray { background: #eef1f5; color: #5b6b7f; }
.badge-yellow { background: #fdf3dd; color: #92660a; }
.badge-orange { background: #fdeadd; color: #a3500d; }
.badge-red { background: #fbe6e3; color: #a3271b; }
.badge-purple { background: #efe7fb; color: #5f3bb3; }

/* ============ KPI 卡片 ============ */
.kpi-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 18px;
}
.kpi-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 14px;
}
.kpi-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.kpi-icon.blue { background: var(--brand-100); color: var(--brand-600); }
.kpi-icon.green { background: #e3f4ec; color: var(--ok); }
.kpi-icon.yellow { background: #fdf3dd; color: var(--warn); }
.kpi-icon.red { background: #fbe6e3; color: var(--danger); }
.kpi-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-label { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ============ 图表区 ============ */
.chart-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-bottom: 18px;
}
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.chart-card h6 { font-weight: 700; color: var(--text-1); margin-bottom: 12px; font-size: 14px; }
.chart-wrap { position: relative; height: 260px; }

/* ============ 表单 ============ */
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.form-label { font-weight: 600; font-size: 13.5px; color: var(--text-1); margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control, .form-select {
    border-radius: 8px; border-color: var(--line);
    min-height: 42px; font-size: 14px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(50,115,209,.12);
}
.form-text { color: var(--text-2); font-size: 12px; }
.input-unit { position: relative; }
.input-unit .unit {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-2); font-size: 12.5px; pointer-events: none;
}

/* ============ 详情页 ============ */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.detail-item {
    background: #f8fafc; border: 1px solid #eef1f6; border-radius: 8px; padding: 12px 14px;
}
.detail-item.full { grid-column: 1 / -1; }
.detail-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.detail-value { font-size: 14px; font-weight: 500; word-break: break-all; white-space: pre-wrap; }


.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(50,115,209,.25), transparent),
        radial-gradient(800px 400px at -10% 110%, rgba(201,154,60,.18), transparent),
        linear-gradient(160deg, var(--brand-900), #122b52 55%, #0d1f3c);
    padding: 20px;
}
.login-card {
    width: 100%; max-width: 420px; background: var(--surface);
    border-radius: 14px; padding: 36px 32px; box-shadow: 0 24px 64px rgba(5, 20, 45, .45);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .logo {
    width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 14px;
    background: var(--brand-800); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.login-brand h1 { font-size: 19px; font-weight: 700; margin: 0; white-space: nowrap; }
.login-brand p { color: var(--text-2); font-size: 13px; margin: 6px 0 0; }

/* ============ 列表合计行（出资人/出资管理等） ============ */
.sum-row td { background: #f6f8fb; border-top: 2px solid var(--brand-500); padding: 10px 12px; }
.sum-row .sum-val { color: var(--brand-700, #1d4ed8); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============ 工具类 ============ */
.page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.page-head h4 { font-weight: 700; margin: 0; }
.text-money { font-variant-numeric: tabular-nums; font-weight: 600; }
.empty-tip { text-align: center; color: var(--text-2); padding: 48px 20px; }
.empty-tip i { font-size: 36px; color: #b9c5d4; display: block; margin-bottom: 10px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--brand-500); display: inline-block; }

/* ============ 手机端适配 ============ */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed; left: -260px; top: 0; bottom: 0;
        transition: left .25s ease; height: 100dvh;
    }
    .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .sidebar-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(13, 31, 60, .45); z-index: 1035;
        opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
    .content { padding: 14px; }
    .topbar { padding: 0 10px; }
    .user-chip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
    .chart-grid { grid-template-columns: 1fr; }
    .toolbar-title { width: 100%; }
}
@media (max-width: 575.98px) {
    html { font-size: 14px; }
    .table { font-size: 13px; }
    .kpi-value { font-size: 19px; }
    .form-card { padding: 16px; }
    .login-card { padding: 28px 20px; }
    /* 标题 16 字随视口自适应，保证单行：容器宽 = 100vw - 40(wrap) - 40(card) */
    .login-brand h1 { font-size: clamp(14px, calc((100vw - 80px) / 16), 19px); }
}

/* ============ 登录页顶部动画（募投管退环绕东临新区标识） ============ */
.login-hero { display: flex; justify-content: center; margin-bottom: 14px; }
.hero-stage { position: relative; width: 320px; height: 320px; flex-shrink: 0; }
/* 同心圆扩散（参照 q1 三层由深到浅圆环） */
.hero-rings { position: absolute; inset: 0; display: grid; place-items: center; }
.hero-rings .ring { position: absolute; border-radius: 50%; animation: ring-breathe 6s ease-in-out infinite; }
.hero-rings .r1 { width: 300px; height: 300px; background: rgba(50,115,209,.06); }
.hero-rings .r2 { width: 236px; height: 236px; background: rgba(50,115,209,.10); animation-delay: -2s; }
.hero-rings .r3 { width: 172px; height: 172px; background: rgba(50,115,209,.16); animation-delay: -4s; }
@keyframes ring-breathe {
    0%, 100% { transform: scale(1); opacity: .9; }
    50% { transform: scale(1.05); opacity: 1; }
}
/* 中心东临新区标识 */
.hero-center { position: absolute; inset: 0; display: grid; place-items: center; }
.hero-center img { width: 118px; filter: drop-shadow(0 6px 16px rgba(5,20,45,.18)); animation: center-float 5s ease-in-out infinite; }
@keyframes center-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
/* 旋转轨道：整体公转，卡片自反转保持文字水平 */
.hero-orbit { position: absolute; inset: 0; animation: orbit-rotate 36s linear infinite; }
.hero-orbit:hover { animation-play-state: paused; }
@keyframes orbit-rotate { to { transform: rotate(360deg); } }
.hero-chip {
    position: absolute; left: 50%; top: 50%;
    margin: -22px 0 0 -58px;
    display: flex; align-items: center; gap: 7px;
    background: rgba(255,255,255,.94);
    border-radius: 999px; padding: 6px 13px 6px 7px;
    box-shadow: 0 6px 18px rgba(5,20,45,.12);
    white-space: nowrap;
    animation: chip-counter 36s linear infinite;
}
@keyframes chip-counter {
    from { transform: rotate(var(--ang)) translateY(-140px) rotate(calc(var(--ang) * -1)); }
    to   { transform: rotate(var(--ang)) translateY(-140px) rotate(calc(var(--ang) * -1 - 360deg)); }
}
.chip-ico {
    width: 30px; height: 30px; border-radius: 50%; background: var(--bg, #e8f0fd);
    display: grid; place-items: center; color: var(--c, #3273d1); font-size: 15px;
    animation: chip-spin 12s linear infinite;
}
@keyframes chip-spin { to { transform: rotate(-360deg); } }
.chip-txt { font-size: 12.5px; font-weight: 600; color: #24324a; }
/* 手机端缩小 */
@media (max-width: 480px) {
    .hero-stage { width: 268px; height: 268px; }
    .hero-rings .r1 { width: 256px; height: 256px; }
    .hero-rings .r2 { width: 200px; height: 200px; }
    .hero-rings .r3 { width: 148px; height: 148px; }
    .hero-center img { width: 96px; }
    .hero-chip { margin: -20px 0 0 -52px; padding: 4px 11px 4px 6px; }
    .chip-ico { width: 26px; height: 26px; font-size: 13px; }
    .chip-txt { font-size: 11.5px; }
}

/* ===== 附件2政务表格风 KV 网格（基金档案/新增/编辑页：标签|内容|标签|内容 四列，内边距放大） ===== */
.kv-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.kv-table th, .kv-table td {
    border: 1px solid #d6deea; padding: 13px 20px; vertical-align: middle;
    font-size: 13.5px; line-height: 1.6;
}
.kv-table th {
    background: #f8fafd; color: var(--text-2); font-weight: 600;
    white-space: nowrap; width: 20%;
}
.kv-table td { background: #fff; color: var(--text-1); font-weight: 700; overflow-wrap: break-word; }
.kv-table th.kv-empty, .kv-table td.kv-empty { background: #fcfdff; }

/* 新增/编辑表单 KV 网格：标签在左、输入在右，两字段一行 */
.kv-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #d6deea; border-left: 1px solid #d6deea; }
.kv-form-grid > .kv-cell {
    display: flex; align-items: center; gap: 16px;
    border-right: 1px solid #d6deea; border-bottom: 1px solid #d6deea;
    padding: 14.5px 20px; background: #fff; min-width: 0;
}
.kv-form-grid > .kv-cell > .form-label { flex: 0 0 34%; max-width: 34%; margin: 0; }
.kv-form-grid > .kv-cell > .form-control,
.kv-form-grid > .kv-cell > .form-select,
.kv-form-grid > .kv-cell > .input-unit { flex: 1 1 auto; width: auto; min-width: 0; }
.kv-form-grid .form-control, .kv-form-grid .form-select { padding: .62rem .95rem; min-height: 46px; }
.kv-form-grid > .kv-cell-full { grid-column: 1 / -1; }
.kv-form-grid > .kv-cell-full > .form-control { width: 100%; }

/* 手机端：KV 表格纵向堆叠、表单单列，标签回到输入框上方 */
@media (max-width: 767.98px) {
    .kv-table, .kv-table tbody, .kv-table tr, .kv-table th, .kv-table td { display: block; width: 100%; box-sizing: border-box; }
    .kv-table th, .kv-table td { margin-top: -1px; }
    .kv-table th.kv-empty, .kv-table td.kv-empty { display: none; }
    .kv-form-grid { grid-template-columns: 1fr; }
    .kv-form-grid > .kv-cell { flex-direction: column; align-items: stretch; gap: 6px; }
    .kv-form-grid > .kv-cell > .form-label { max-width: none; }
}
