/* ==========================================================
   云璞 OA 系统 - 全局样式（完整版 · 含移动端适配）
   ========================================================== */

/* ---------- 变量 ---------- */
:root {
    --oa-primary:     #0d6efd;
    --oa-primary-600: #0b5ed7;
    --oa-success:     #198754;
    --oa-warning:     #ffc107;
    --oa-danger:      #dc3545;
    --oa-info:        #0dcaf0;
    --oa-text:        #1f2329;
    --oa-text-muted:  #6c757d;
    --oa-border:      #e9ecef;
    --oa-bg-soft:     #f7f9fc;
    --oa-radius:      12px;
    --oa-shadow:      0 2px 10px rgba(0, 0, 0, .04);
    --oa-shadow-hover:0 6px 20px rgba(0, 0, 0, .08);
    --oa-transition:  all .2s ease;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", Tahoma, Geneva, Verdana,
                 sans-serif;
    font-size: 14px;
    color: var(--oa-text);
    background-color: var(--oa-bg-soft);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: var(--oa-primary);
    transition: var(--oa-transition);
}
a:hover { color: var(--oa-primary-600); }

/* ---------- 布局 ---------- */
.d-flex { display: flex; }

.sidebar {
    background-color: #fff;
    border-right: 1px solid var(--oa-border);
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background-color: #ddd; border-radius: 3px; }

.main-content {
    flex: 1;
    overflow-y: auto;
    height: 100vh;
    padding: 24px;
}

/* ---------- 侧边栏 ---------- */
.sidebar h5 {
    font-size: 15px;
    letter-spacing: .5px;
    color: var(--oa-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .nav-link {
    padding: 9px 14px;
    border-radius: 8px;
    margin-bottom: 2px;
    font-size: 13.5px;
    color: var(--oa-text);
    transition: var(--oa-transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .nav-link i { width: 18px; text-align: center; }
.sidebar .nav-link:hover {
    background-color: var(--oa-bg-soft);
    color: var(--oa-primary);
}
.sidebar .nav-link.active {
    background-color: rgba(13, 110, 253, .08);
    color: var(--oa-primary);
    font-weight: 600;
}
.sidebar .nav .collapse .nav-link {
    font-size: 13px;
    padding: 6px 14px;
    color: #6c757d;
    border-radius: 6px;
}
.sidebar .nav .collapse .nav-link:hover {
    color: var(--oa-primary);
    background-color: rgba(13, 110, 253, .06);
}
.sidebar .nav .collapse .nav-link.active {
    color: var(--oa-primary);
    background-color: rgba(13, 110, 253, .1);
    font-weight: 600;
}

.sidebar .nav.flex-column.ms-3 {
    border-left: 1px dashed #e5e7eb;
    padding-left: 6px;
    margin-left: 22px !important;
}

.sidebar .nav-link[data-bs-toggle="collapse"] .fa-chevron-down {
    transition: transform .25s ease;
    font-size: 10px;
    opacity: .6;
}
.sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

/* ---------- 卡片 ---------- */
.card {
    border-radius: var(--oa-radius);
    border: none;
    box-shadow: var(--oa-shadow);
    transition: var(--oa-transition);
}
.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--oa-border);
    border-radius: var(--oa-radius) var(--oa-radius) 0 0 !important;
    font-size: 14px;
}
.card-header h5,
.card-header h6 { font-size: 15px; margin: 0; }
.card-body { padding: 20px; }

/* ---------- 表格 ---------- */
.table {
    font-size: 13.5px;
    margin-bottom: 0;
    vertical-align: middle;
}
.table > :not(caption) > * > * { padding: 10px 12px; }
.table thead th {
    font-weight: 600;
    color: #495057;
    background-color: #fafbfc !important;
    border-bottom: 1px solid var(--oa-border);
    white-space: nowrap;
}
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, .035);
}

/* ---------- 按钮 ---------- */
.btn {
    border-radius: 8px;
    font-size: 13.5px;
    padding: 6px 14px;
    transition: var(--oa-transition);
}
.btn-sm { font-size: 12.5px; padding: 4px 10px; }
.btn-primary {
    background-color: var(--oa-primary);
    border-color: var(--oa-primary);
}
.btn-primary:hover {
    background-color: var(--oa-primary-600);
    border-color: var(--oa-primary-600);
}

/* ---------- 表单 ---------- */
.form-label {
    font-size: 13px;
    color: #495057;
    font-weight: 500;
    margin-bottom: 4px;
}
.form-control, .form-select {
    border-radius: 8px;
    font-size: 13.5px;
    border: 1px solid #dee2e6;
    padding: 7px 12px;
    transition: var(--oa-transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--oa-primary);
    box-shadow: 0 0 0 .18rem rgba(13, 110, 253, .15);
}
.input-group-text {
    border-radius: 8px 0 0 8px;
    font-size: 13.5px;
}

/* ---------- 徽章 ---------- */
.badge {
    font-weight: 500;
    font-size: 11.5px;
    padding: 4px 8px;
    border-radius: 5px;
    vertical-align: middle;
}
.badge.bg-light {
    color: #495057 !important;
    border: 1px solid var(--oa-border);
}

/* ---------- 进度条 ---------- */
.progress { background-color: #eef1f5; border-radius: 6px; overflow: hidden; }
.progress-bar { transition: width .4s ease; }

/* ---------- 头像 ---------- */
.rounded-circle { object-fit: cover; }

/* ---------- 欢迎横幅 ---------- */
.welcome-banner {
    background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
    border: 1px solid #eaf1fb !important;
}
.welcome-banner h4 { font-size: 18px; color: var(--oa-text); }
.welcome-banner p { font-size: 13px; margin-bottom: 0; }
.welcome-banner .text-end > div { font-size: 13px; line-height: 1.8; }

/* ---------- 列表组 ---------- */
.list-group-item {
    border-color: var(--oa-border);
    padding: 14px 18px;
    font-size: 13.5px;
    transition: var(--oa-transition);
}
.list-group-item:hover { background-color: #fafbfc; }
.list-group-item h6 { font-size: 14px; }

/* ---------- 常用功能图标 ---------- */
.bg-light.rounded-circle { transition: var(--oa-transition); }
.bg-light.rounded-circle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, .15);
}

/* ---------- 分页 ---------- */
.pagination { margin: 0; }
.page-link {
    color: var(--oa-primary);
    border-radius: 6px !important;
    margin: 0 2px;
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid var(--oa-border);
}
.page-link:hover {
    background-color: rgba(13, 110, 253, .06);
    color: var(--oa-primary);
}
.page-item.active .page-link {
    background-color: var(--oa-primary);
    border-color: var(--oa-primary);
}

/* ---------- 提示框 ---------- */
.alert { border-radius: 10px; font-size: 13.5px; border: none; }
.alert-info    { background-color: #e7f6fb; color: #055160; }
.alert-success { background-color: #e7f6ee; color: #0a3622; }
.alert-warning { background-color: #fff8e5; color: #664d03; }
.alert-danger  { background-color: #fdeaee; color: #58151c; }

/* ---------- 滚动条 ---------- */
.main-content::-webkit-scrollbar { width: 8px; }
.main-content::-webkit-scrollbar-thumb { background-color: #d0d7de; border-radius: 4px; }

/* ---------- 工具类 ---------- */
.rounded-3 { border-radius: var(--oa-radius) !important; }
.rounded-4 { border-radius: 16px !important; }
.text-muted { color: var(--oa-text-muted) !important; }
.fw-bold    { font-weight: 600 !important; }
.fs-6       { font-size: 13px !important; }
.fs-5       { font-size: 16px !important; }
.fs-4       { font-size: 20px !important; }
.fs-3       { font-size: 24px !important; }
.fs-2       { font-size: 28px !important; }
.small      { font-size: 12.5px !important; }

/* ---------- 数字输入框 ---------- */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* ---------- 弹窗 ---------- */
.modal-content {
    border-radius: var(--oa-radius);
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .12);
}

/* ==========================================================
   追加：页面统一美化（o-card / o-table / stat-row 等）
   ========================================================== */

.page-wrap { max-width: 1400px; margin: 0 auto; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef1f5;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header .ph-left { display: flex; align-items: center; gap: 12px; }
.page-header .ph-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(13, 110, 253, .10);
    color: #0d6efd;
}
.page-header h2 { font-size: 20px; font-weight: 700; margin: 0; }
.page-header .ph-desc { font-size: 13px; color: #6c757d; margin-top: 2px; }

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    border: 1px solid #eef1f5;
    border-radius: 12px;
    padding: 16px 18px;
    transition: all .2s;
}
.stat-card:hover {
    box-shadow: 0 6px 20px rgba(13, 110, 253, .08);
    border-color: #cfe2ff;
}
.stat-card .label { font-size: 12.5px; color: #6c757d; margin-bottom: 6px; }
.stat-card .value { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }

.o-card {
    background: #fff;
    border: 1px solid #eef1f5;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
}
.o-card-header {
    padding: 14px 20px;
    background: #fafbfc;
    border-bottom: 1px solid #eef1f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.o-card-header h6 {
    margin: 0;
    font-weight: 700;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.o-card-body { padding: 20px; }
.o-card-body.p-0 { padding: 0; }

.o-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 13.5px;
}
.o-table thead th {
    background: #fafbfc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .3px;
    border-bottom: 1px solid #eef1f5;
    white-space: nowrap;
}
.o-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f4f6f9;
    vertical-align: middle;
}
.o-table tbody tr { transition: background .15s; }
.o-table tbody tr:hover { background: #fafbfc; }
.o-table tbody tr:last-child td { border-bottom: none; }
.o-table .cell-main { font-weight: 600; color: #1f2329; }
.o-table .cell-sub { font-size: 12.5px; color: #6c757d; margin-top: 2px; }

.mini-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0d6efd;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    margin-right: 10px;
}

.empty-state { padding: 60px 20px; text-align: center; color: #6c757d; }
.empty-state i { font-size: 48px; opacity: .2; margin-bottom: 16px; display: block; }
.empty-state .title { font-size: 15px; font-weight: 600; color: #1f2329; margin-bottom: 6px; }
.empty-state .desc { font-size: 13px; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions .btn { font-size: 12.5px; padding: 4px 10px; }

.f-group { margin-bottom: 18px; }
.f-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}
.f-label .required { color: #dc3545; margin-left: 2px; }
.f-help { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.f-input, .f-select, .f-textarea {
    width: 100%;
    padding: 9px 14px;
    font-size: 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    transition: all .2s;
    font-family: inherit;
    color: #1f2329;
}
.f-input:focus, .f-select:focus, .f-textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .10);
}
.f-textarea { resize: vertical; min-height: 100px; line-height: 1.7; }

.f-section {
    margin: 28px 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14.5px;
    color: #1f2329;
}
.f-section i { color: #0d6efd; }
.f-section .hint { font-size: 12.5px; color: #94a3b8; font-weight: 400; margin-left: auto; }

.upload-box {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: #fafbfc;
    display: block;
}
.upload-box:hover { border-color: #0d6efd; background: #f0f7ff; }
.upload-box i { font-size: 32px; color: #94a3b8; margin-bottom: 10px; display: block; }
.upload-box .title { font-size: 13.5px; font-weight: 600; color: #1f2329; }
.upload-box .desc { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.upload-box input[type="file"] { display: none; }

.upload-list { margin-top: 10px; }
.upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}
.upload-item i.fa-file { color: #0d6efd; margin-right: 8px; }
.upload-item .rm { color: #dc3545; cursor: pointer; padding: 2px 8px; border-radius: 4px; }
.upload-item .rm:hover { background: #fee; }

.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}
.tag-pending  { background: #fef3c7; color: #92400e; }
.tag-approved { background: #d1fae5; color: #065f46; }
.tag-rejected { background: #fee2e2; color: #991b1b; }
.tag-draft    { background: #e5e7eb; color: #374151; }

/* ==========================================================
   移动端适配
   ========================================================== */

/* 平板 / 手机：< 992px */
@media (max-width: 992px) {

    /* 侧边栏改成抽屉 */
    .sidebar {
        position: fixed !important;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1050;
        width: 260px !important;
        transition: left .3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, .15);
        height: 100vh;
    }
    .sidebar.show {
        left: 0;
    }

    /* 主内容区 padding 缩小 */
    .flex-grow-1.p-4 {
        padding: 12px !important;
    }

    /* 顶部欢迎栏竖排 */
    .welcome-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 16px !important;
    }
    .welcome-banner .text-end {
        text-align: left !important;
        margin-top: 12px;
    }
    .welcome-banner h4 { font-size: 16px !important; }

    /* 顶部工具条 */
    .top-bar { padding: 8px 12px !important; padding-left: 64px !important; }
    .top-bar-title { font-size: 13px !important; display: none; }
    .top-bar-logo { display: none; }

    /* KPI 卡片 2 列 */
    .stat-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
    .stat-card {
        padding: 12px 14px !important;
    }
    .stat-card .value { font-size: 18px !important; }
    .stat-card .label { font-size: 11px !important; }

    /* 页面标题栏竖排 */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }
    .page-header h2 { font-size: 18px !important; }
    .page-header .ph-icon { width: 38px; height: 38px; font-size: 17px; }

    /* 表格改卡片式 */
    .o-table thead { display: none !important; }
    .o-table tbody tr {
        display: block;
        margin-bottom: 12px;
        background: #fff;
        border: 1px solid #eef1f5;
        border-radius: 12px;
        padding: 12px 14px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, .03);
    }
    .o-table tbody td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0 !important;
        border: none !important;
        text-align: right !important;
        font-size: 13px;
    }
    .o-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #94a3b8;
        font-size: 12px;
        text-align: left;
        margin-right: 12px;
        flex-shrink: 0;
    }

    /* 待办条目 */
    .wb-todo-item { padding: 12px 16px !important; }
    .wb-todo-item .left { width: 100%; }
    .wb-todo-item .text-end {
        width: 100%;
        text-align: left !important;
        margin-top: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 图表 */
    .bar-chart { height: 150px !important; }
    .bi-kpi { padding: 14px 16px; }
    .bi-kpi .value { font-size: 20px; }
    .bi-kpi .icon { width: 40px; height: 40px; font-size: 17px; margin-bottom: 10px; }

    /* 卡片 padding 缩小 */
    .o-card-body { padding: 14px !important; }
    .o-card-header { padding: 12px 14px !important; }

    /* 表单控件字体加大防缩放 */
    .f-input, .f-select, .f-textarea,
    .form-control, .form-select {
        font-size: 16px !important;
    }
    .btn { font-size: 13px; padding: 6px 12px; }
    .pagination { justify-content: center; }

    /* 表格里的按钮 */
    .row-actions { justify-content: flex-end; }
    .row-actions .btn { padding: 3px 8px; font-size: 11.5px; }
}

/* 手机：< 576px */
@media (max-width: 576px) {
    .stat-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px;
    }
    .stat-card { padding: 10px 12px !important; }
    .stat-card .value { font-size: 16px !important; }
    .stat-card .label { font-size: 10.5px !important; }

    .page-header h2 { font-size: 16px !important; }

    .flex-grow-1.p-4 { padding: 10px !important; }

    .welcome-banner { padding: 12px !important; }
    .welcome-banner h4 { font-size: 14px !important; }
    .welcome-banner p { font-size: 12px !important; }
    .welcome-banner img { width: 44px !important; height: 44px !important; }
    .welcome-banner .text-end > div { font-size: 11.5px !important; }

    .o-table tbody td {
        padding: 5px 0 !important;
        font-size: 12.5px;
    }

    .wb-todo-item .title { font-size: 13px; }
    .wb-todo-item .meta { font-size: 11.5px; }

    .bi-chart { padding: 14px 12px !important; }
    .bi-chart h6 { font-size: 13px !important; margin-bottom: 12px; }
    .bi-chart .chart-box { height: 220px !important; }
    .bi-chart .chart-box-sm { height: 200px !important; }

    /* 隐藏顶部下拉里的多余文字 */
    .top-bar-right .dropdown-toggle span { display: none; }
}

/* 大屏：> 1920px 时内容居中最大宽度 */
@media (min-width: 1920px) {
    .flex-grow-1.p-4 {
        max-width: 1600px;
        margin: 0 auto;
    }
}

/* 打印：隐藏交互元素 */
@media print {
    .sidebar, .top-bar, .btn, .card-header .btn,
    .card-header .btn-group, #sidebarToggle, #sidebarOverlay {
        display: none !important;
    }
    .flex-grow-1.p-4 {
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
        max-width: none;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
}