/* ═══════════════════════════════════════════════════════════════
   WPS 文档协同 — 门户样式（Editor.cshtml 不使用本文件）
   ═══════════════════════════════════════════════════════════════ */

:root {
    --portal-primary: #e8710a;
    --portal-primary-dark: #cf6409;
    --portal-bg: #f5f7fa;
    --portal-sidebar: #f7f8fb;
    --portal-sidebar-hover: rgba(232, 113, 10, 0.08);
    --portal-sidebar-active-bg: #ffedd5;
    --portal-sidebar-active-text: #ea580c;
    --portal-sidebar-border: #e8ecf1;
    --portal-text: #1f2937;
    --portal-muted: #6b7280;
    --portal-border: #e5e7eb;
    --portal-card-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --portal-radius: 12px;
}

html, body {
    height: 100%;
}

body.portal-body {
    margin: 0;
    background: var(--portal-bg);
    color: var(--portal-text);
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
}

/* ── 顶栏 ── */
.portal-topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--portal-text);
    font-weight: 700;
    font-size: 17px;
}

.portal-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ff9a3c, var(--portal-primary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.portal-topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--portal-muted);
}

.portal-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.portal-link-muted {
    color: var(--portal-muted);
    text-decoration: none;
    font-size: 14px;
}

.portal-link-muted:hover {
    color: var(--portal-primary);
}

/* ── 布局：侧栏 + 主区 ── */
.portal-shell {
    display: flex;
    min-height: calc(100vh - 56px);
}

.portal-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--portal-sidebar);
    border-right: 1px solid var(--portal-sidebar-border);
    padding: 20px 12px;
}

.portal-nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    padding: 0 12px 8px;
    margin-top: 8px;
}

.portal-nav-label:first-child {
    margin-top: 0;
}

.portal-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.portal-nav a:hover {
    background: var(--portal-sidebar-hover);
    color: #334155;
}

.portal-nav a.active {
    background: var(--portal-sidebar-active-bg);
    color: var(--portal-sidebar-active-text);
    font-weight: 500;
}

.portal-nav a.active .portal-nav-icon {
    opacity: 1;
}

.portal-nav-icon {
    width: 20px;
    text-align: center;
    opacity: .9;
}

.portal-main {
    flex: 1;
    padding: 28px 32px 40px;
    overflow-x: auto;
}

/* ── 页面标题区 ── */
.portal-page-header {
    margin-bottom: 24px;
}

.portal-page-header h1 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    color: var(--portal-text);
}

.portal-page-header p {
    margin: 0;
    color: var(--portal-muted);
    font-size: 14px;
}

.portal-page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.portal-form-card {
    max-width: 720px;
}

.portal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
}

.portal-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.portal-form-group.portal-form-check {
    justify-content: flex-end;
    padding-bottom: 4px;
}

.portal-form-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.portal-form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
}

.portal-form-input:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px rgba(232, 113, 10, 0.12);
}

.portal-form-error {
    font-size: 12px;
    color: #dc2626;
}

.portal-form-check-label {
    font-size: 14px;
    color: var(--portal-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-help-list {
    margin: 0;
    padding-left: 20px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.8;
}

.portal-badge-ok {
    background: #ecfdf5;
    color: #047857;
}

.portal-badge-off {
    background: #fef2f2;
    color: #b91c1c;
}

.portal-badge-role {
    background: #eff6ff;
    color: #1d4ed8;
}

.portal-dept-indent {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.portal-dept-tree {
    color: #9ca3af;
    font-family: monospace;
}

select.portal-dept-select option {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}

.portal-dept-tree-multi {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    max-height: 260px;
    overflow-y: auto;
}

.portal-dept-tree-multi-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 0;
    margin: 0;
    font-size: 13px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.portal-dept-tree-multi-row:last-child {
    border-bottom: none;
}

.portal-dept-tree-multi-row:hover {
    background: #f8fafc;
}

.portal-dept-tree-multi-row input[type="checkbox"] {
    margin: 0;
    accent-color: #ea580c;
    flex-shrink: 0;
}

.portal-dept-tree-multi-empty {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.portal-template-config-hidden {
    display: none !important;
}

.portal-dept-select-group .portal-dept-search-input {
    margin-bottom: 8px;
}

.portal-dept-tree-multi {
    max-height: 320px;
}

/* ── 卡片 ── */
.portal-card {
    background: #fff;
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-card-shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.portal-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
}

/* ── 统计卡片 ── */
.portal-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.portal-stat-card {
    background: #fff;
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    padding: 20px 22px;
    box-shadow: var(--portal-card-shadow);
}

.portal-stat-card .label {
    font-size: 13px;
    color: var(--portal-muted);
    margin-bottom: 8px;
}

.portal-stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--portal-text);
}

.portal-stat-card.accent {
    border-color: rgba(232, 113, 10, .25);
    background: linear-gradient(135deg, #fffaf5 0%, #fff 100%);
}

.portal-stat-card.accent .value {
    color: var(--portal-primary);
}

/* ── 按钮 ── */
.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}

.portal-btn-primary {
    background: var(--portal-primary);
    color: #fff;
}

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

.portal-btn-outline {
    background: #fff;
    color: var(--portal-text);
    border: 1px solid var(--portal-border);
}

.portal-btn-outline:hover {
    border-color: #ccc;
    color: var(--portal-text);
}

.portal-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

.portal-btn-danger-outline {
    background: #fff;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.portal-btn-danger-outline:hover {
    background: #fef2f2;
}

.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* ── 上传区 ── */
.portal-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: var(--portal-radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafafa;
}

.portal-upload-zone:hover,
.portal-upload-zone.drag-over {
    border-color: var(--portal-primary);
    background: #fffaf5;
}

.portal-upload-zone .icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: .7;
}

.portal-upload-zone .title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 6px;
}

.portal-upload-zone .hint {
    font-size: 13px;
    color: var(--portal-muted);
}

/* ── 文档表格 ── */
.portal-table-wrap {
    overflow-x: auto;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.portal-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f9fafb;
    color: var(--portal-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--portal-border);
}

.portal-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--portal-border);
    vertical-align: middle;
}

.portal-table tbody tr:hover {
    background: #fafafa;
}

.portal-file-name {
    font-weight: 500;
    color: var(--portal-text);
}

.portal-file-meta {
    font-size: 12px;
    color: var(--portal-muted);
    margin-top: 2px;
}

.portal-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: #f3f4f6;
    color: var(--portal-muted);
}

.portal-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--portal-muted);
}

.portal-empty .icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: .4;
}

/* ── 快捷入口卡片 ── */
.portal-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.portal-quick-card {
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s, border-color .2s;
    display: block;
}

.portal-quick-card:hover {
    box-shadow: var(--portal-card-shadow);
    border-color: rgba(232, 113, 10, .3);
    color: inherit;
}

.portal-quick-card .qc-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fff4eb;
    color: var(--portal-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
}

.portal-quick-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.portal-quick-card p {
    margin: 0;
    font-size: 13px;
    color: var(--portal-muted);
    line-height: 1.5;
}

/* ── Alert ── */
.portal-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
}

.portal-alert-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.portal-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.portal-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 12px;
}

.portal-progress-bar {
    height: 100%;
    background: var(--portal-primary);
    animation: portal-pulse 1.2s ease-in-out infinite;
}

@keyframes portal-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

.portal-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--portal-muted);
}

.portal-share-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-share-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.portal-share-dialog {
    position: relative;
    width: min(520px, calc(100vw - 32px));
    margin: 0;
    z-index: 1;
}

.portal-share-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
    background: #f9fafb;
}

@media (max-width: 768px) {
    .portal-shell {
        flex-direction: column;
    }
    .portal-sidebar {
        width: 100%;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid var(--portal-sidebar-border);
    }
    .portal-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
    }
    .portal-nav a {
        white-space: nowrap;
        margin-bottom: 0;
    }
    .portal-main {
        padding: 20px 16px;
    }
    .portal-form-grid {
        grid-template-columns: 1fr;
    }
}
