/* =====================================================================
   之予企服管理平台 · 自定义样式
   极简、全中文、响应式；金额右对齐；状态色统一。
   ===================================================================== */

:root {
    --app-primary: #2b5cff;
    --app-navbar: #1f2937;
    --app-sidebar-width: 210px;
    --app-sidebar-bg: #f8f9fb;
    --app-border: #e5e8ee;
}

body.app-body {
    background: #f2f4f7;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶栏 */
.app-navbar {
    background: var(--app-navbar);
}

/* 布局容器 */
.app-container {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

/* 侧边栏 */
.app-sidebar {
    width: var(--app-sidebar-width);
    background: var(--app-sidebar-bg);
    border-right: 1px solid var(--app-border);
    flex-shrink: 0;
}

.sidebar-inner {
    padding: 12px 8px;
    position: sticky;
    top: 0;
}

/* 侧边栏分组标题 —— 同时是「折叠开关」按钮 */
.sidebar-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: 0;
    font-family: inherit;
    text-align: left;
    font-size: .72rem;
    line-height: 1.2;
    color: #98a2b3;
    padding: 12px 12px 6px;
    letter-spacing: .05em;
    cursor: pointer;
}

.sidebar-group-title:hover {
    color: #667085;
}

/* 折叠三角：展开朝下，收起朝右 */
.sidebar-caret {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    margin-left: 8px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform .15s ease;
}

.sidebar-group.collapsed .sidebar-caret {
    transform: rotate(-90deg);
}

.sidebar-group.collapsed .sidebar-group-body {
    display: none;
}

.sidebar-link {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: #344054;
    text-decoration: none;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}

.sidebar-link:hover {
    background: #eaeefb;
    color: var(--app-primary);
}

.sidebar-link.active {
    background: var(--app-primary);
    color: #fff;
}

/* 主内容 */
.app-main {
    flex: 1 1 auto;
    padding: 18px 22px 30px;
    min-width: 0;
}

.page-header {
    margin-bottom: 14px;
}

.app-card {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.app-card .card-header {
    border-bottom: 1px solid var(--app-border);
    border-radius: 10px 10px 0 0 !important;
}

/* 页脚 */
.app-footer {
    border-top: 1px solid var(--app-border);
    background: #fff;
}

/* 金额单元格右对齐（红线 §4.3） */
.amount, td.amount, .text-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: "Consolas", "Courier New", monospace;
}

/* 空态 */
.empty-state {
    color: #98a2b3;
}

/* 日志详情 pre */
.log-pre {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    padding: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow: auto;
    margin-top: 4px;
}

/* 待办角标 */
#todo-badge {
    font-size: .62rem;
    vertical-align: super;
}

/* ---------- 登录页 ---------- */
.login-body {
    background: linear-gradient(135deg, #1f2937 0%, #2b5cff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.login-wrapper {
    width: 100%;
    max-width: 380px;
    padding: 16px;
}

.login-card {
    border: none;
    border-radius: 14px;
}

/* 错误页 */
.error-page {
    min-height: 50vh;
}

/* 表格表头 */
.table > :not(caption) > * > * {
    padding: .6rem .75rem;
}

/* ---------------------------------------------------------------------
   宽表格防塌陷（2026-10-05 修订）
   问题：中文表头 + 列多时，浏览器会优先压缩列宽，导致表头逐字换行
        （如「研发占比」竖排、「5.00%」被拆成两行）。
   对策：① 表头与数值单元格不换行；② 给 min-width 保证横向可滚而不挤压。
   ⚠️ 只作用于 .table，不影响表单/卡片。
   --------------------------------------------------------------------- */
.table > thead > tr > th {
    white-space: nowrap;
}

/* 数值/状态类单元格不换行（表头已覆盖，此处防数据行拆行） */
.table > tbody > tr > td.text-end,
.table > tbody > tr > td.text-nowrap,
.table > tbody > tr > td.amount {
    white-space: nowrap;
}

/* 表格自身最小宽度：不足时由 .table-responsive 横向滚动，而非压扁列 */
.app-card .table-responsive > .table {
    min-width: 720px;
}

/* 窄屏豁免：小屏下允许换行，靠横向滚动兜底 */
@media (max-width: 768px) {
    .app-card .table-responsive > .table {
        min-width: 620px;
    }
}

/* 响应式：窄屏隐藏侧栏分组标题冗余 */
@media (max-width: 768px) {
    .app-sidebar {
        display: none;
    }
    .app-main {
        padding: 14px;
    }
}
