/* ==========================================================
   骏骥电脑 - 工作台 / 下载中心 / 用户管理页面样式
   ========================================================== */

:root {
    --ws-primary: #3b82f6;
    --ws-primary-dark: #2563eb;
    --ws-text: #1a1a2e;
    --ws-text-2: #4a4a6a;
    --ws-border: #e2e8f0;
    --ws-bg: #f5f7fb;
}

body.ws-body {
    background: var(--ws-bg);
    color: var(--ws-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- 顶部栏 ---------- */
.ws-topbar {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 900;
}

.ws-topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ws-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ws-primary);
}

.ws-brand i { font-size: 1.7rem; }

.ws-brand small {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ws-text-2);
    padding-left: 0.5rem;
    border-left: 1px solid var(--ws-border);
}

.ws-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ws-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.95rem;
    border-radius: 6px;
    border: 2px solid var(--ws-primary);
    color: var(--ws-primary);
    background: transparent;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
}

.ws-link:hover {
    background: var(--ws-primary);
    color: #fff;
}

.ws-link-solid {
    background: var(--ws-primary);
    color: #fff;
}

.ws-link-solid:hover {
    background: var(--ws-primary-dark);
    border-color: var(--ws-primary-dark);
}

/* .ws-link 自己设了 display，必须补上这条才能让 hidden 属性真正生效
   （否则未登录/角色未确认时会先闪出一个链接按钮） */
.ws-link[hidden] {
    display: none;
}

/* ---------- 主体容器 ---------- */
.ws-main {
    flex: 1;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}

/* 宽屏页面（报价单预览等）：尽量把可用宽度用满，方便一屏看完表格 */
.ws-main.ws-wide {
    max-width: 1760px;
}

/* 全宽页面（下载中心）：顶栏内容与正文一起占满浏览器宽度，
   两者的左右内边距都是 1.25rem，所以标题、账号按钮与下方白色面板的边缘会对齐。
   文件卡片用的是 auto-fill 网格，变宽后会自动多排几列，不需要额外调整。 */
.ws-body.is-full .ws-topbar-inner,
.ws-body.is-full .ws-main {
    max-width: none;
}

.ws-panel {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* 紧凑面板：减少留白，把空间让给内容 */
.ws-panel.ws-compact {
    padding: 1.1rem 1.2rem;
}

.ws-panel-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--ws-border);
}

.ws-panel-head h1,
.ws-panel-head h2 {
    font-size: 1.35rem;
    margin: 0;
    color: var(--ws-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ws-panel-head h1 i,
.ws-panel-head h2 i { color: var(--ws-primary); }

.ws-panel-head .ws-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* 报价页操作按钮行：主页 / 下载中心 / 预览配件报价
   位于标题下一行，统一靠左排列 */
.ws-quote-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* 三个按钮原本各有各的尺寸：.ws-link 是 padding .45rem/.95rem、字号 .92rem，
   .xlsx-start 是 padding .6rem/1.4rem、字号 .95rem，放同一行明显大小不一。
   这里在按钮行内统一尺寸，并给一个统一最小宽度，
   让「主页」这类短文字按钮也撑到相同宽度，三个按钮看起来才是一组。
   （选择器限定在 .ws-quote-bar 内，不影响页面其他地方复用的 .ws-link） */
.ws-quote-bar .ws-link,
.ws-quote-bar .xlsx-start {
    justify-content: center;
    min-width: 8rem;
    margin-top: 0;
    padding: 0.5rem 1rem;
    border: 2px solid var(--ws-primary);
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
}

.ws-sub {
    color: var(--ws-text-2);
    font-size: 0.92rem;
    margin-bottom: 1rem;
}

/* ---------- 统计小卡片 ---------- */
.ws-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ws-stat {
    background: #fff;
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
    border-left: 4px solid var(--ws-primary);
}

.ws-stat b {
    display: block;
    font-size: 1.7rem;
    color: var(--ws-text);
}

.ws-stat span {
    font-size: 0.88rem;
    color: var(--ws-text-2);
}

.ws-stat.is-warn { border-left-color: #f59e0b; }
.ws-stat.is-danger { border-left-color: #ef4444; }
.ws-stat.is-ok { border-left-color: #10b981; }

/* ---------- 表格 ---------- */
.ws-table-wrap {
    overflow-x: auto;
}

.ws-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.ws-table th,
.ws-table td {
    padding: 0.7rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--ws-border);
    font-size: 0.94rem;
    vertical-align: middle;
}

.ws-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
    white-space: nowrap;
}

.ws-table tbody tr:hover { background: #f8fafc; }

.ws-tag {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    background: #64748b;
    white-space: nowrap;
}

.ws-tag-normal { background: #3b82f6; }
.ws-tag-core { background: #f59e0b; }
.ws-tag-admin { background: #ef4444; }
.ws-tag-pending { background: #f59e0b; }
.ws-tag-approved { background: #10b981; }
.ws-tag-rejected { background: #94a3b8; }

.ws-row-btn {
    padding: 0.28rem 0.7rem;
    font-size: 0.84rem;
    border-radius: 5px;
    border: 1px solid var(--ws-primary);
    background: #fff;
    color: var(--ws-primary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 0 0.2rem 0.2rem 0;
    font-family: inherit;
}

.ws-row-btn:hover { background: var(--ws-primary); color: #fff; }
.ws-row-btn.is-danger { border-color: #ef4444; color: #ef4444; }
.ws-row-btn.is-danger:hover { background: #ef4444; color: #fff; }
.ws-row-btn.is-ok { border-color: #10b981; color: #10b981; }
.ws-row-btn.is-ok:hover { background: #10b981; color: #fff; }
.ws-row-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- 筛选标签 ---------- */
.ws-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ws-chip {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--ws-border);
    background: #fff;
    color: var(--ws-text-2);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.ws-chip:hover { border-color: var(--ws-primary); color: var(--ws-primary); }

.ws-chip.is-active {
    background: var(--ws-primary);
    border-color: var(--ws-primary);
    color: #fff;
    font-weight: 600;
}

/* ---------- 文件列表（下载中心） ---------- */
.ws-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    background: #fff;
    min-width: 240px;
}

.ws-search i { color: #94a3b8; }

.ws-search input {
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
    color: var(--ws-text);
    background: transparent;
}

.ws-folder-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: #334155;
    padding: 0.6rem 0.2rem 0.4rem;
    font-size: 1rem;
}

.ws-folder-title i { color: #f59e0b; }

.ws-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    font-size: 1.15rem;
    color: var(--ws-primary);
}

.ws-locked {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: #94a3b8;
}

.ws-path {
    font-size: 0.82rem;
    color: #94a3b8;
    word-break: break-all;
}

/* ---------- 文件小卡片（下载中心） ---------- */
.ws-dir {
    margin-bottom: 1.5rem;
}

.ws-dir:last-child {
    margin-bottom: 0;
}

.ws-dir .ws-folder-title {
    padding: 0.2rem 0.1rem 0.6rem;
    border-bottom: 1px dashed var(--ws-border);
    margin-bottom: 0.8rem;
}

.ws-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.7rem;
}

.ws-file-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    background: #fff;
    min-width: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ws-file-card:hover {
    border-color: var(--ws-primary);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.16);
    transform: translateY(-2px);
}

.ws-file-card .ws-file-icon {
    width: 2.2rem;
    height: 2.2rem;
    flex: 0 0 auto;
    border-radius: 7px;
    background: #eff6ff;
    font-size: 1.05rem;
    color: var(--ws-primary);
}

.ws-file-body {
    flex: 1 1 auto;
    min-width: 0;
}

.ws-file-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ws-text);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ws-file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.15rem;
    font-size: 0.74rem;
    color: #94a3b8;
}

.ws-file-meta i {
    margin-right: 0.22rem;
}

.ws-file-dl {
    flex: 0 0 auto;
    width: 1.95rem;
    height: 1.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--ws-primary);
    color: #fff;
    font-size: 0.82rem;
    transition: background 0.2s ease;
}

.ws-file-dl:hover {
    background: var(--ws-primary-dark);
    color: #fff;
}

.ws-file-card.is-locked {
    background: #f8fafc;
    border-style: dashed;
}

.ws-file-card.is-locked .ws-file-icon {
    background: #f1f5f9;
    color: #94a3b8;
}

.ws-file-card.is-locked .ws-file-name {
    color: #94a3b8;
}

.ws-file-card.is-locked .ws-file-meta {
    color: #cbd5e1;
}

/* ---------- 空状态 / 提示 ---------- */
.ws-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--ws-text-2);
}

.ws-empty i {
    font-size: 3rem;
    color: #cbd5e1;
    display: block;
    margin-bottom: 0.8rem;
}

.ws-empty p { margin-bottom: 0.4rem; }

.ws-alert {
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    font-size: 0.94rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    border-left: 4px solid var(--ws-primary);
    background: #eff6ff;
    color: #1e3a8a;
}

.ws-alert.is-warn { border-left-color: #f59e0b; background: #fffbeb; color: #92400e; }
.ws-alert.is-error { border-left-color: #ef4444; background: #fef2f2; color: #991b1b; }
.ws-alert.is-ok { border-left-color: #10b981; background: #ecfdf5; color: #065f46; }

.ws-alert code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.88em;
}

/* ---------- Excel 报价表展示 ---------- */
.xlsx-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.7rem;
}

.xlsx-tab {
    padding: 0.3rem 0.85rem;
    border-radius: 6px 6px 0 0;
    border: 1px solid var(--ws-border);
    border-bottom: none;
    background: #f1f5f9;
    color: var(--ws-text-2);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
}

.xlsx-tab.is-active {
    background: #fff;
    color: var(--ws-primary);
    font-weight: 700;
    border-color: var(--ws-primary);
}

.xlsx-sheet {
    overflow: auto;
    max-height: 80vh;
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    background: #fff;
}

/* 字号与内边距尽量小，保证一张报价表能横向看完 */
.xlsx-sheet table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.xlsx-sheet th,
.xlsx-sheet td {
    border: 1px solid var(--ws-border);
    padding: 0.18rem 0.38rem;
    text-align: left;
    white-space: nowrap;
    line-height: 1.5;
    color: var(--ws-text);
}

.xlsx-sheet thead th {
    font-size: 0.76rem;
}

.xlsx-sheet thead th {
    position: sticky;
    top: 0;
    background: #f1f5f9;
    z-index: 1;
    font-weight: 700;
}

.xlsx-sheet tbody tr:nth-child(even) { background: #f8fafc; }
.xlsx-sheet tbody tr:hover { background: #eff6ff; }

/* 报价单“点击才加载”占位按钮（页面打开时不自动预览 Excel） */
.xlsx-start {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.9rem;
    padding: 0.6rem 1.4rem;
    border: 2px solid var(--ws-primary);
    border-radius: 6px;
    background: var(--ws-primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
}

.xlsx-start:hover:not(:disabled) {
    background: var(--ws-primary-dark);
    border-color: var(--ws-primary-dark);
}

.xlsx-start:disabled {
    opacity: 0.55;
    cursor: default;
}

/* 该按钮位于 .ws-empty 内部，需要复位被 .ws-empty i 放大的图标 */
.xlsx-start i {
    font-size: 1rem;
    display: inline;
    margin-bottom: 0;
    color: inherit;
}

/* ---------- 页脚 ---------- */
.ws-footer {
    background: #1a1a2e;
    color: #cbd5e1;
    text-align: center;
    padding: 1.1rem;
    font-size: 0.88rem;
}

.ws-footer a { color: #93c5fd; }

/* ---------- 加载遮罩 ---------- */
.ws-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ws-text-2);
}

.ws-loading i {
    font-size: 2rem;
    color: var(--ws-primary);
    animation: wsSpin 1s linear infinite;
    display: block;
    margin-bottom: 0.8rem;
}

@keyframes wsSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .ws-actions { width: 100%; margin-left: 0; }
    .ws-link { flex: 1; justify-content: center; }
    .ws-main { padding: 1rem 0.8rem 2rem; }
    .ws-panel { padding: 1rem; }
    /* 报价页按钮行：窄屏下按钮自动换行，换到新行/并排的按钮平分宽度 */
    .ws-quote-bar .ws-link,
    .ws-quote-bar .xlsx-start { flex: 1; }
}
