/* ==========================================================================
   通用企业官网系统 - 公共样式（设计系统）
   配色/字号/间距/组件均依据《UI设计规范与页面原型说明》
   ========================================================================== */

:root {
    /* 主色 */
    --c-primary: #154A8A;
    --c-primary-dark: #0F3A6A;
    --c-primary-light: #2B6CB0;
    --c-primary-bg: #E8F0FB;

    /* 辅助色 */
    --c-secondary: #00A0E9;
    --c-success: #2ECC71;
    --c-warning: #F39C12;
    --c-danger: #E74C3C;
    --c-info: #3498DB;

    /* 中性色 */
    --c-title: #1A1A1A;
    --c-text: #333333;
    --c-text-sub: #666666;
    --c-text-mute: #999999;
    --c-border: #E0E0E0;
    --c-border-light: #EEEEEE;
    --c-bg: #F5F7FA;
    --c-bg-card: #FFFFFF;
    --c-bg-hover: #F8F9FA;
    --c-bg-disabled: #F0F0F0;
    --c-input-border: #D9D9D9;

    /* 深色区块（页脚 / 后台侧边栏） */
    --c-dark: #2C3E50;
    --c-dark-border: #34495E;
    --c-dark-text: #ECF0F1;
    --c-dark-text-sub: #BDC3C7;

    /* 渐变 */
    --g-banner: linear-gradient(135deg, #1E5AA8 0%, #00A0E9 100%);
    --g-button: linear-gradient(135deg, #1E5AA8 0%, #3B7DD6 100%);
    --g-data: linear-gradient(135deg, #00A0E9 0%, #2ECC71 100%);

    /* 间距（8px 栅格） */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 32px;
    --sp-2xl: 48px;
    --sp-3xl: 64px;

    /* 圆角与阴影 */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, .06);
    --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, .1);
    --shadow-modal: 0 4px 20px rgba(0, 0, 0, .15);

    /* 布局 */
    --container: 1200px;
    --gutter: 24px;
    --header-h: 70px;
    --sidebar-w: 220px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 60px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.7;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-md); color: var(--c-title); font-weight: 600; }
h1 { font-size: 32px; line-height: 1.3; }
h2 { font-size: 24px; line-height: 1.4; }
h3 { font-size: 20px; line-height: 1.4; }
h4 { font-size: 18px; line-height: 1.5; }

p { margin: 0 0 var(--sp-md); }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--c-primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--c-primary-dark); }

img { max-width: 100%; height: auto; border: 0; vertical-align: middle; }

table { border-collapse: collapse; border-spacing: 0; width: 100%; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 布局容器 ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

.row { display: flex; flex-wrap: wrap; margin: 0 calc(var(--gutter) / -2); }
.row > [class*="col-"] { padding: 0 calc(var(--gutter) / 2); }

.col-1 { width: 8.3333%; }   .col-2 { width: 16.6667%; }
.col-3 { width: 25%; }       .col-4 { width: 33.3333%; }
.col-5 { width: 41.6667%; }  .col-6 { width: 50%; }
.col-7 { width: 58.3333%; }  .col-8 { width: 66.6667%; }
.col-9 { width: 75%; }       .col-10 { width: 83.3333%; }
.col-11 { width: 91.6667%; } .col-12 { width: 100%; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { flex: none; }

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); color: #fff; }

.btn-default { background: #fff; border-color: var(--c-input-border); color: var(--c-text); }
.btn-default:hover { border-color: var(--c-primary); color: var(--c-primary); background: #fff; }

.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #C0392B; color: #fff; }

.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #27AE60; color: #fff; }

.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .6); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; color: #fff; }

.btn-text { background: none; border: 0; color: var(--c-primary); height: auto; padding: 0 4px; }
.btn-text:hover { background: none; color: var(--c-primary-dark); text-decoration: underline; }
.btn-text.danger { color: var(--c-danger); }

.btn-link { background: none; border: 0; color: var(--c-primary); text-decoration: underline; height: auto; padding: 0; }

.btn-lg { height: 44px; padding: 0 24px; font-size: 16px; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-block { display: flex; width: 100%; }

.btn:disabled, .btn.disabled {
    background: var(--c-bg-disabled);
    border-color: var(--c-border);
    color: var(--c-text-mute);
    cursor: not-allowed;
    transform: none;
}
.btn-primary:disabled, .btn-primary.disabled { background: var(--c-bg-disabled); }

.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-default.loading::after { border-color: rgba(30, 90, 168, .25); border-top-color: var(--c-primary); }

@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; gap: var(--sp-sm); }

/* ---------- 表单 ---------- */
.input, .textarea, .select {
    display: block;
    width: 100%;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--c-text);
    background: #fff;
    border: 1px solid var(--c-input-border);
    border-radius: var(--r-sm);
    transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 90px; padding: 8px 12px; line-height: 1.7; resize: vertical; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
/* 多选列表框：取消单选固定高度与箭头，按 size 展开并保底可见行数，方便勾选 */
.select[multiple] { height: auto; min-height: 168px; padding: 6px 8px; background-image: none; }
.input:focus, .textarea:focus, .select:focus {
    outline: 0;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px rgba(30, 90, 168, .1);
}
.input::placeholder, .textarea::placeholder { color: var(--c-text-mute); }
.input:disabled, .textarea:disabled, .select:disabled { background: var(--c-bg-disabled); border-color: var(--c-border); color: var(--c-text-mute); cursor: not-allowed; }
.input[readonly], .textarea[readonly] { background: #FAFAFA; border-color: var(--c-border); }
.input.error, .textarea.error, .select.error { border-color: var(--c-danger); }

.form-item { margin-bottom: var(--sp-md); }
.form-label { display: block; margin-bottom: 6px; font-size: 14px; line-height: 1.5; color: var(--c-text); font-weight: 500; }
.form-label .req { color: var(--c-danger); margin-left: 2px; }
.form-help { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--c-text-mute); }
.form-error { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--c-danger); }

/* 横向表单（后台） */
.form-horizontal .form-item { display: flex; align-items: flex-start; }
.form-horizontal .form-label { flex: 0 0 120px; width: 120px; padding-top: 8px; margin-bottom: 0; text-align: left; }
.form-horizontal .form-control { flex: 1; min-width: 0; }

.checkbox, .radio { display: inline-flex; align-items: center; gap: 6px; margin-right: var(--sp-md); cursor: pointer; font-size: 14px; }
.checkbox input, .radio input { width: 16px; height: 16px; margin: 0; accent-color: var(--c-primary); cursor: pointer; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider {
    position: absolute; inset: 0;
    background: #ccc; border-radius: 22px;
    transition: background-color .2s;
    pointer-events: none;
}
.switch .slider::before {
    content: ""; position: absolute; left: 2px; top: 2px;
    width: 18px; height: 18px; background: #fff; border-radius: 50%;
    transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + .slider { background: var(--c-primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; background: #fff; }
.table { width: 100%; font-size: 13px; }
.table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-sub);
    background: #FAFAFA;
    border-bottom: 1px solid var(--c-border-light);
    white-space: nowrap;
}
.table td {
    padding: 10px 12px;
    color: var(--c-text);
    border-bottom: 1px solid var(--c-border-light);
    vertical-align: middle;
}
.table tbody tr { height: 48px; transition: background-color .15s; }
.table tbody tr:hover { background: var(--c-bg); }
.table tbody tr.selected { background: var(--c-primary-bg); }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .col-actions .btn-text { margin-left: var(--sp-sm); }
.table .cell-title { color: var(--c-title); font-weight: 500; }
.table-striped tbody tr:nth-child(even) { background: #FAFAFA; }
.table-sortable th.sortable { cursor: pointer; user-select: none; }
.table-sortable th.sortable:hover { color: var(--c-primary); }
.table-sortable th.active { color: var(--c-primary); }

/* ---------- 卡片 ---------- */
.card {
    background: var(--c-bg-card);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
}
.card-hover { transition: box-shadow .25s, transform .25s; }
.card-hover:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md);
    padding-bottom: var(--sp-md); margin-bottom: var(--sp-md);
    border-bottom: 1px solid var(--c-border-light);
}
.card-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--c-title); }
.card-body { padding: 0; }
.card-foot { padding-top: var(--sp-md); margin-top: var(--sp-md); border-top: 1px solid var(--c-border-light); }
.card-flush { padding: 0; }
.card-flush .card-head, .card-flush .card-foot { padding-left: 20px; padding-right: 20px; }
.card-flush .card-body { padding: 0 20px 20px; }

/* ---------- 标签 ---------- */
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 8px;
    font-size: 12px; line-height: 1;
    border-radius: var(--r-sm);
    white-space: nowrap;
}
.tag-primary { background: var(--c-primary-bg); color: var(--c-primary); }
.tag-success { background: #E8F8F0; color: var(--c-success); }
.tag-warning { background: #FEF5E7; color: var(--c-warning); }
.tag-danger  { background: #FDEDEC; color: var(--c-danger); }
.tag-info    { background: #EBF5FB; color: var(--c-info); }
.tag-gray    { background: var(--c-bg-disabled); color: var(--c-text-sub); }

.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    font-size: 11px; line-height: 1; color: #fff;
    background: var(--c-danger); border-radius: 9px;
}

/* ---------- 提示 ---------- */
.alert {
    position: relative;
    padding: var(--sp-md);
    padding-left: 20px;
    border-radius: var(--r-sm);
    border-left: 4px solid var(--c-info);
    background: rgba(52, 152, 219, .1);
    color: var(--c-text);
    font-size: 14px;
    margin-bottom: var(--sp-md);
}
.alert-success { border-left-color: var(--c-success); background: rgba(46, 204, 113, .1); }
.alert-warning { border-left-color: var(--c-warning); background: rgba(243, 156, 18, .1); }
.alert-danger  { border-left-color: var(--c-danger);  background: rgba(231, 76, 60, .1); }
.alert-title { font-weight: 600; margin-bottom: 4px; }

.toast-wrap {
    position: fixed; top: var(--sp-lg); left: 50%; transform: translateX(-50%);
    z-index: 10000; display: flex; flex-direction: column; gap: var(--sp-sm);
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: var(--sp-sm);
    min-height: 48px; padding: 0 var(--sp-lg);
    border-radius: var(--r-sm);
    color: #fff; font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
    animation: toast-in .25s ease-out;
    pointer-events: auto;
}
.toast-success { background: var(--c-success); }
.toast-error   { background: var(--c-danger); }
.toast-warning { background: var(--c-warning); }
.toast-info    { background: var(--c-info); }
.toast.hide { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(0, 0, 0, .5);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 10vh;
    animation: fade-in .2s;
}
.modal {
    width: 600px; max-width: calc(100vw - 32px); max-height: 80vh;
    display: flex; flex-direction: column;
    background: #fff; border-radius: var(--r-md);
    box-shadow: var(--shadow-modal);
    animation: modal-in .22s ease-out;
}
.modal-sm { width: 400px; }
.modal-lg { width: 800px; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md);
    height: 56px; padding: 0 var(--sp-lg); flex: none;
    border-bottom: 1px solid var(--c-border-light);
}
.modal-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--c-title); display: flex; align-items: center; gap: var(--sp-sm); }
.modal-close { background: none; border: 0; padding: 4px; cursor: pointer; color: var(--c-text-mute); line-height: 0; border-radius: var(--r-sm); }
.modal-close:hover { color: var(--c-text); background: var(--c-bg-hover); }
.modal-body { padding: var(--sp-lg); overflow-y: auto; }
.modal-foot {
    display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-sm);
    height: 64px; padding: 0 var(--sp-lg); flex: none;
    border-top: 1px solid var(--c-border-light);
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(-16px); } }

/* ---------- 分页 ---------- */
.pagination-wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-md); flex-wrap: wrap;
    margin-top: var(--sp-lg);
}
.pagination-total { font-size: 13px; color: var(--c-text-sub); }
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 8px;
    font-size: 13px; color: var(--c-text);
    background: #fff; border: 1px solid var(--c-input-border); border-radius: var(--r-sm);
    transition: all .2s;
}
.pagination a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pagination .current, .pagination .active {
    background: var(--c-primary); border-color: var(--c-primary); color: #fff; cursor: default;
}
.pagination .disabled { color: var(--c-text-mute); background: var(--c-bg-disabled); cursor: not-allowed; }
.pagination .gap { border: 0; background: none; }

/* ---------- 面包屑 ---------- */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--c-text-mute); }
.breadcrumb a { color: var(--c-text-sub); }
.breadcrumb a:hover { color: var(--c-primary); }
.breadcrumb .sep { color: #CCC; }
.breadcrumb .current { color: var(--c-text); }

/* ---------- 空状态 ---------- */
.empty { padding: var(--sp-3xl) var(--sp-lg); text-align: center; }
.empty-icon { color: #DCE1E8; margin-bottom: var(--sp-md); }
.empty-title { font-size: 16px; color: var(--c-text-sub); margin-bottom: var(--sp-xs); }
.empty-desc { font-size: 13px; color: var(--c-text-mute); margin-bottom: var(--sp-lg); }

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.gap-xs { gap: var(--sp-xs); } .gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); } .gap-lg { gap: var(--sp-lg); }

.text-primary { color: var(--c-primary); }
.text-success { color: var(--c-success); }
.text-warning { color: var(--c-warning); }
.text-danger  { color: var(--c-danger); }
.text-sub  { color: var(--c-text-sub); }
.text-mute { color: var(--c-text-mute); }
.text-title { color: var(--c-title); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 16px; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-sm { margin-top: var(--sp-sm); } .mb-sm { margin-bottom: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); } .mb-md { margin-bottom: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); } .mb-lg { margin-bottom: var(--sp-lg); }
.mt-xl { margin-top: var(--sp-xl); } .mb-xl { margin-bottom: var(--sp-xl); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--c-border-light); margin: var(--sp-md) 0; }
.icon { display: inline-block; vertical-align: middle; flex: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1023px) {
    .container { padding: 0 16px; }
    :root { --gutter: 16px; }
}

@media (max-width: 767px) {
    .container { padding: 0 12px; }
    :root { --gutter: 12px; --sp-3xl: 40px; --sp-2xl: 32px; }
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    .col-3, .col-4, .col-6, .col-8, .col-9 { width: 100%; }
    .form-horizontal .form-item { display: block; }
    .form-horizontal .form-label { flex: none; width: auto; padding-top: 0; margin-bottom: 6px; }
    .modal { width: 95% !important; max-height: 90vh; }
    .modal-mask { padding-top: 5vh; }
    .pagination-wrap { justify-content: center; }
}

@media (max-width: 479px) {
    body { font-size: 13px; }
    .btn-lg { height: 40px; padding: 0 18px; font-size: 15px; }
}

@media print {
    .no-print { display: none !important; }
}
