/* 工具箱全局设计变量（字体、色板、圆角、阴影） */
:root {
    --tbx-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --tbx-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --tbx-primary: #667eea;
    --tbx-primary-dark: #764ba2;
    --tbx-primary-soft: #eef1ff;
    --tbx-gradient: linear-gradient(135deg, var(--tbx-primary), var(--tbx-primary-dark));
    --tbx-color-text: #1e293b;
    --tbx-color-text-secondary: #64748b;
    --tbx-color-text-muted: #94a3b8;
    --tbx-color-bg: #f5f7fa;
    --tbx-color-surface: #ffffff;
    --tbx-color-border: #e2e8f0;
    --tbx-color-border-input: #d0d9e8;
    --tbx-sidebar-bg: #e4eaf3;
    --tbx-radius-sm: 6px;
    --tbx-radius-md: 8px;
    --tbx-radius-lg: 12px;
    --tbx-shadow-card: 0 4px 15px rgba(15, 23, 42, 0.08);
    --tbx-font-size-sm: 13px;
    --tbx-font-size-base: 14px;
    --tbx-font-size-lg: 16px;
    --tbx-line-height: 1.6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; }

body {
    font-family: var(--tbx-font-sans);
    font-size: var(--tbx-font-size-base);
    line-height: var(--tbx-line-height);
    background: var(--tbx-color-bg);
    min-height: 100vh;
    color: var(--tbx-color-text);
    -webkit-font-smoothing: antialiased;
}

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

code, kbd, pre, samp {
    font-family: var(--tbx-font-mono);
    font-size: 0.92em;
}

/* 顶栏全宽；其下左侧导航 + 右侧功能页 */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}
.app-topbar {
    width: 100%;
    flex-shrink: 0;
}
.app-workspace {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: row;
    align-items: stretch;
    min-height: 0;
    background: var(--tbx-color-bg);
}
.sidebar-slot {
    flex: 0 0 272px;
    width: 272px;
    overflow: visible;
    transition: width 0.25s ease, flex-basis 0.25s ease;
}
.app-layout.sidebar-collapsed .sidebar-slot {
    flex: 0 0 36px;
    width: 36px;
}
.app-sidebar {
    width: 100%;
    height: 100%;
    background: var(--tbx-sidebar-bg);
    border-right: 1px solid var(--tbx-color-border-input);
    overflow: visible;
}
.app-layout.sidebar-collapsed .app-sidebar {
    border-right: none;
}
.app-content {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 28px 40px;
    overflow-y: auto;
    background: #f5f7fa;
}

/* 侧栏内面板（与主内容区背景区分） */
.sidebar-panel {
    height: 100%;
    padding: 14px 12px 20px;
    overflow-y: auto;
}
.sidebar-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 32px;
}
.app-layout.sidebar-collapsed .sidebar-panel-head {
    display: flex;
    justify-content: center;
    padding: 14px 4px;
    margin-bottom: 0;
}
.app-layout.sidebar-collapsed .sidebar-brand {
    display: none;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}
.sidebar-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--tbx-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-brand-text { font-size: 15px; font-weight: 600; color: #2d3748; }

/* 树状菜单独立白底区域（隐藏/显示只作用于此块） */
.sidebar-tree-wrap {
    position: relative;
    margin-top: 4px;
}
.sidebar-tree-panel {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #dce4f0;
    box-shadow: 0 2px 12px rgba(30, 45, 90, 0.08);
    padding: 10px 10px 12px 6px;
    transition: opacity 0.2s ease;
}
.app-layout.sidebar-collapsed .sidebar-tree-panel {
    display: none;
}
.sidebar-nav {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.side-menu,
.side-menu > li,
.side-children,
.side-children > li {
    display: block;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
}
.side-node { margin-bottom: 2px; }

.side-leaf-link,
.side-parent-link {
    text-decoration: none;
    color: #3d4657;
    transition: background 0.15s ease, color 0.15s ease;
}
/* 树形：左侧展开按钮 + 文字区留白 */
.tree-toggle,
.tree-spacer,
.tree-leaf {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin-right: 6px;
}
.tree-spacer,
.tree-leaf {
    display: inline-block;
    flex-shrink: 0;
}
.tree-toggle {
    border: 1px solid #c5d0e3;
    border-radius: 4px;
    background: #f8fafc;
    color: #5a6578;
    font-size: 14px;
    line-height: 18px;
    cursor: pointer;
    padding: 0;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tree-toggle::before { content: '+'; }
.side-node--branch.is-open > .side-parent-row .tree-toggle::before { content: '−'; }
.side-node--branch.is-open > .side-parent-row .tree-toggle {
    background: #eef1ff;
    border-color: #a5b4fc;
    color: #5a67d8;
}
.tree-toggle:hover { background: #eef1ff; border-color: #667eea; color: #667eea; }
.side-leaf-link {
    display: flex;
    align-items: center;
    padding: 9px 8px 9px 4px;
    border-radius: 8px;
    font-size: 14px;
}
.side-leaf-icon,
.side-parent-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #f0f3fa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 8px;
}
.side-leaf-label,
.side-parent-label,
.side-child-label {
    padding-left: 2px;
}
.side-leaf-link:hover,
.side-parent-link:hover { background: #f3f6ff; color: #5a67d8; }
.side-leaf-link.is-current,
.side-parent-link.is-current,
.side-child-link.is-current {
    background: linear-gradient(135deg, #eef1ff 0%, #f5f0ff 100%);
    color: #5a67d8;
    font-weight: 600;
}
.side-node.is-active > .side-parent-row .side-parent-icon {
    background: #e0e7ff;
}

.side-parent-row {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 4px 6px 4px 4px;
    border-radius: 8px;
}
.side-parent-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 4px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.side-children-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}
.side-node--branch.is-open > .side-children-wrap { grid-template-rows: 1fr; }
.side-children {
    overflow: hidden;
    min-height: 0;
    margin: 0 0 6px 0;
    padding: 2px 0 4px 32px;
}
.side-child-link {
    display: flex;
    align-items: center;
    padding: 8px 8px 8px 10px;
    color: #5a6578;
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}
.side-child-link:hover { background: #f8f9ff; color: #667eea; }
.side-empty { padding: 12px 10px 12px 14px; font-size: 13px; color: #94a3b8; }

/* 与「TB 工具箱」同一行的隐藏/展开条钮 */
.sidebar-toggle-btn {
    flex-shrink: 0;
    width: 32px;
    height: 16px;
    min-height: 16px;
    max-height: 16px;
    padding: 0;
    margin: 0;
    border: 1px solid #d0d9e8;
    border-radius: 4px;
    background: #fff;
    color: #64748b;
    font-size: 10px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(30, 45, 90, 0.14);
    transition: background 0.15s ease;
}
.sidebar-toggle-btn:hover {
    color: #667eea;
    border-color: #a5b4fc;
    background: #f5f7ff;
}
.app-layout.sidebar-collapsed .sidebar-toggle-btn {
    border-radius: 0 4px 4px 0;
}

.header {
    background: var(--tbx-gradient);
    color: #fff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.header h1 { font-size: 22px; }
.user-info { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.user-name { font-size: 14px; opacity: .95; }
.logout-form { display: inline; margin: 0; }
.logout-btn { border: none; cursor: pointer; font: inherit; }
.btn-link { color: #fff; text-decoration: none; background: rgba(255,255,255,.2); padding: 8px 14px; border-radius: 6px; }
.container { max-width: 1100px; margin: 0 auto; }
.container.narrow { max-width: 720px; }
/* Django messages 由 toast.js 转为浮动提示，此处仅作无 JS 兜底 */
.page-messages { list-style: none; margin-bottom: 16px; }
.page-messages[data-toast-source] { display: none; }
.page-messages li { padding: 12px; border-radius: 6px; margin-bottom: 8px; }
.page-messages .success { background: #d4edda; color: #155724; }
.page-messages .error { background: #fee; color: #900; }
.page-messages .warning { background: #fff3cd; color: #856404; }
.page-messages .info { background: #e7f3ff; color: #06c; }

/* 顶部浮动提示 */
.tbx-toast-container {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: min(92vw, 520px);
    pointer-events: none;
}
.tbx-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px 14px 14px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.06);
    opacity: 0;
    transform: translateY(-16px) scale(0.98);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.tbx-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.tbx-toast.is-leaving {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition-duration: 0.2s;
}
.tbx-toast-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1.2;
}
.tbx-toast--success .tbx-toast-badge { background: #dcfce7; color: #166534; }
.tbx-toast--success { border-left: 4px solid #22c55e; }
.tbx-toast--error .tbx-toast-badge { background: #fee2e2; color: #991b1b; }
.tbx-toast--error { border-left: 4px solid #ef4444; }
.tbx-toast--warning .tbx-toast-badge { background: #fef3c7; color: #92400e; }
.tbx-toast--warning { border-left: 4px solid #f59e0b; }
.tbx-toast--info .tbx-toast-badge { background: #e0f2fe; color: #075985; }
.tbx-toast--info { border-left: 4px solid #3b82f6; }
.tbx-toast-text {
    flex: 1;
    margin: 2px 0 0;
    font-size: 14px;
    line-height: 1.55;
    color: #1e293b;
    word-break: break-word;
}
.tbx-toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin: -4px -6px 0 0;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.tbx-toast-close:hover {
    background: #f1f5f9;
    color: #475569;
}

@media (max-width: 900px) {
    .app-workspace { flex-direction: column; }
    .app-sidebar { width: 100%; flex: none; max-height: 40vh; }
    .side-children { margin-left: 8px; padding-left: 18px; }
}
.card {
    background: var(--tbx-color-surface);
    border-radius: var(--tbx-radius-lg);
    padding: 28px;
    box-shadow: var(--tbx-shadow-card);
    margin-bottom: 24px;
}
.card h2, .card h3 { margin-bottom: 16px; color: var(--tbx-color-text); }
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--tbx-radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: var(--tbx-font-size-base);
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.list-filter-form {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}
.list-filter-form .form-control,
.list-filter-form input[type="search"] {
    width: auto;
    min-width: 200px;
    flex: 1 1 200px;
    max-width: 320px;
}
.btn.primary { background: var(--tbx-gradient); color: #fff; }
.btn.secondary { background: #eef1f8; color: #444; }
.btn.danger { background: #fee; color: #900; border: 1px solid #fcc; }

/* 知识库资料行：操作区横向排列，勿被全宽 input 规则撑破 */
.asset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.asset-actions .action-item,
.asset-actions > form {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    margin: 0;
}
.asset-actions .action-input,
.asset-actions input.action-input[type="text"] {
    width: 180px;
    max-width: 220px;
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid var(--tbx-color-border-input);
    border-radius: var(--tbx-radius-sm);
    font-size: var(--tbx-font-size-sm);
}

.alert { padding: 14px; border-radius: 6px; margin-bottom: 16px; }
.alert.error { background: #fee; color: #900; border-left: 4px solid #c00; }
.alert.info { background: #e7f3ff; color: #06c; border-left: 4px solid #06c; }
.file-drop {
    border: 2px dashed var(--tbx-primary);
    border-radius: var(--tbx-radius-md);
    padding: 32px;
    text-align: center;
    margin-bottom: 20px;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.file-drop:hover { background: var(--tbx-primary-soft); border-color: var(--tbx-primary-dark); }
.file-drop--pick {
    position: relative;
    cursor: pointer;
    padding: 40px 32px;
}
.file-drop--pick input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.file-drop__icon { font-size: 48px; margin-bottom: 12px; line-height: 1; }
.file-drop__text { color: var(--tbx-color-text-secondary); font-size: var(--tbx-font-size-lg); }
.file-drop__hint { color: var(--tbx-color-text-muted); font-size: var(--tbx-font-size-sm); margin-top: 8px; }
.file-drop__text.is-selected { color: var(--tbx-primary); font-weight: 500; }
.file-drop input { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; background: #eef1f8; border-radius: 6px; text-decoration: none; color: #444; }
.tabs a.active { background: #667eea; color: #fff; }
.outline-tree { list-style: none; padding-left: 0; }
.outline-tree ul { padding-left: 24px; }
.outline-tree li { margin: 8px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.outline-tree input[type=text] { flex: 1; min-width: 200px; padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; }
.status-badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #eef1f8; }
.status-badge.done { background: #d4edda; color: #155724; }
.status-badge.generating { background: #fff3cd; color: #856404; }

/* mammoth Word 预览 */
.docx-mammoth { line-height: 1.6; font-size: 15px; color: #222; }
.docx-mammoth p { margin: 0.6em 0; }
.docx-mammoth h1, .docx-mammoth h2, .docx-mammoth h3 { margin: 1em 0 0.5em; }
.docx-mammoth table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.docx-mammoth td, .docx-mammoth th { border: 1px solid #ccc; padding: 6px 10px; vertical-align: top; }
.docx-mammoth img { max-width: 100%; height: auto; display: block; margin: 8px 0; }

/* 全局确认 / 提示弹窗（挂 body 末尾，position:fixed 全屏居中） */
body.tbx-dialog-open { overflow: hidden; }
#toolboxDialogOverlay.tbx-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 24px;
    box-sizing: border-box;
    z-index: 99999;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
}
#toolboxDialogOverlay.tbx-dialog-overlay.is-open {
    display: flex;
}
#toolboxDialogOverlay .tbx-dialog {
    flex: 0 0 auto;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    padding: 28px 28px 22px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
    text-align: center;
}
.tbx-dialog-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
}
.tbx-icon-question { background: #eef2ff; color: #4f46e5; }
.tbx-icon-question::before { content: '?'; font-weight: 700; }
.tbx-icon-warn { background: #fef3c7; color: #b45309; }
.tbx-icon-warn::before { content: '!'; font-weight: 700; }
.tbx-icon-info { background: #e0f2fe; color: #0369a1; }
.tbx-icon-info::before { content: 'i'; font-family: Georgia, serif; font-style: italic; }
.tbx-icon-error { background: #fee2e2; color: #b91c1c; }
.tbx-icon-error::before { content: '!'; font-weight: 700; }
.tbx-dialog-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}
.tbx-dialog-message {
    margin: 0 0 22px;
    font-size: 14px;
    line-height: 1.65;
    color: #64748b;
    text-align: left;
    max-height: 50vh;
    overflow-y: auto;
}
.tbx-dialog-message p { margin: 0 0 8px; }
.tbx-dialog-message p:last-child { margin-bottom: 0; }
.tbx-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.tbx-dialog-actions .btn {
    min-width: 96px;
    padding: 10px 22px;
    font-size: 14px;
}
.tbx-dialog--alert .tbx-dialog-actions .tbx-dialog-ok { min-width: 120px; }
.tbx-dialog--danger .tbx-dialog-title { color: #991b1b; }

/* 项目信息弹窗（导入后补全名称/编号） */
.project-meta-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 100001;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
.project-meta-modal.open { display: flex; }
.project-meta-box {
    background: #fff;
    width: 92%;
    max-width: 480px;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
.project-meta-box h3 { margin: 0 0 8px; font-size: 18px; color: #222; }
.project-meta-hint { margin: 0 0 16px; color: #555; font-size: 14px; line-height: 1.6; }
.project-meta-field { display: block; margin-bottom: 14px; }
.project-meta-field span {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
}
.project-meta-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
}
.project-meta-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}
.project-list-actions a.project-meta-edit {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
}
.project-list-actions a.project-meta-edit:hover { text-decoration: underline; }

.list-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e8ecf2;
    font-size: 13px;
    color: #555;
}
.list-pagination__sizes {
    margin: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.list-pagination__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.list-pagination__label-text,
.list-pagination__label-suffix {
    flex-shrink: 0;
    white-space: nowrap;
}
.list-pagination__select {
    width: auto;
    min-width: 3.5rem;
    padding: 6px 28px 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    flex-shrink: 0;
}
.list-pagination__info {
    white-space: nowrap;
    flex-shrink: 0;
}
.list-pagination__links {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .list-pagination__links { flex-wrap: wrap; }
}
.list-pagination__btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}
.list-pagination__btn { padding: 6px 12px; font-size: 13px; }

/* —— 排版与通用工具类 —— */
.muted { color: var(--tbx-color-text-muted); }
.text-secondary { color: var(--tbx-color-text-secondary); }
.text-sm { font-size: var(--tbx-font-size-sm); }
.text-lg { font-size: var(--tbx-font-size-lg); }
.page-intro { margin-bottom: 24px; color: var(--tbx-color-text-secondary); line-height: var(--tbx-line-height); }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }

/* 招标文件申领：列表/新建页操作按钮单行 */
.tender-claim-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    vertical-align: middle;
}
td.tender-claim-actions {
    display: table-cell;
    white-space: nowrap;
}
td.tender-claim-actions .tender-claim-actions-inner {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}
.tender-claim-actions form,
.tender-claim-actions-inner form {
    display: inline-flex;
    margin: 0;
    flex: 0 0 auto;
}
.tender-claim-actions .btn,
.tender-claim-actions-inner .btn,
.tender-claim-actions > a.btn {
    flex-shrink: 0;
}
.claim-enterprise-toolbar select {
    flex: 0 1 auto;
    min-width: 200px;
    max-width: 360px;
}
.claim-row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}
.claim-row-actions .claim-asset-select {
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 360px;
    width: auto;
    padding: 6px;
}
.tender-claim-list-table th:last-child,
.tender-claim-list-table td.tender-claim-actions {
    min-width: 300px;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.link-primary { color: var(--tbx-primary); text-decoration: none; font-size: var(--tbx-font-size-sm); }
.link-primary:hover { text-decoration: underline; }

.app-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tbx-color-text);
    margin-bottom: 16px;
}
.app-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tbx-color-text);
    margin-bottom: 12px;
}

/* —— 表单 —— */
.form-label,
.label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--tbx-font-size-sm);
    font-weight: 500;
    color: var(--tbx-color-text-secondary);
}
.form-control,
.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="search"],
.form-field input[type="url"],
.form-field input[type="tel"],
.form-field select,
.form-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--tbx-color-border-input);
    border-radius: var(--tbx-radius-sm);
    background: var(--tbx-color-surface);
    font-size: var(--tbx-font-size-base);
    line-height: 1.45;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--tbx-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}
.form-field { display: block; margin-bottom: 14px; }
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
}
.form-row > .form-field { flex: 1 1 180px; margin-bottom: 0; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-lg { padding: 12px 20px; font-size: var(--tbx-font-size-lg); }

/* —— 登录 / 独立页（无侧栏） —— */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--tbx-gradient);
}
.auth-box {
    background: var(--tbx-color-surface);
    padding: 40px;
    border-radius: var(--tbx-radius-lg);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.2);
    width: 100%;
    max-width: 400px;
}
.auth-box h1 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--tbx-color-text);
    margin-bottom: 28px;
}
.auth-box .form-field { margin-bottom: 18px; }
.auth-box .input-wrapper { position: relative; }
.auth-box .input-wrapper .form-control { padding-right: 40px; }
.auth-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    color: var(--tbx-primary);
    user-select: none;
}
.auth-error {
    color: #e74c3c;
    margin-bottom: 18px;
    text-align: center;
    font-size: var(--tbx-font-size-sm);
}
.auth-hint {
    font-size: 12px;
    color: var(--tbx-color-text-muted);
    text-align: center;
    margin-top: 16px;
}

.standalone-page { min-height: 100vh; background: var(--tbx-color-bg); }
.standalone-page .header h1 { font-size: 1.35rem; }
.standalone-page .container { margin-top: 32px; margin-bottom: 40px; }
.standalone-loading {
    display: none;
    text-align: center;
    margin-top: 20px;
    color: var(--tbx-primary);
    font-size: var(--tbx-font-size-lg);
}

/* —— 控制台功能卡片 —— */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.feature-card {
    background: var(--tbx-color-surface);
    border-radius: var(--tbx-radius-lg);
    padding: 24px;
    box-shadow: var(--tbx-shadow-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}
.feature-icon { font-size: 40px; margin-bottom: 12px; line-height: 1; }
.feature-name { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; color: var(--tbx-color-text); }
.feature-desc { color: var(--tbx-color-text-secondary); font-size: var(--tbx-font-size-base); line-height: 1.5; }

/* —— 预览区域 —— */
.preview-toolbar { margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.docx-preview-body { line-height: 1.75; font-size: 15px; color: var(--tbx-color-text); }
.docx-preview-body h3 { margin: 16px 0 8px; color: var(--tbx-color-text); }
.docx-preview-body p { margin: 8px 0; }
.pdf-frame,
.img-preview {
    width: 100%;
    min-height: 70vh;
    border: 1px solid var(--tbx-color-border);
    border-radius: var(--tbx-radius-md);
}
.img-preview { object-fit: contain; max-height: 80vh; display: block; margin: 0 auto; }

/* —— Word / 文件预览弹窗（全站共用） —— */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.modal.open { display: flex; }
.modal-box {
    background: var(--tbx-color-surface);
    width: 92%;
    max-width: 960px;
    max-height: 90vh;
    border-radius: var(--tbx-radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}
.modal-head {
    padding: 14px 20px;
    border-bottom: 1px solid var(--tbx-color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.modal-head-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: var(--tbx-font-size-lg);
    color: var(--tbx-color-text);
}
.modal-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.modal-body {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
    background: #f8fafc;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--tbx-color-text-muted);
    padding: 4px 8px;
    border-radius: var(--tbx-radius-sm);
}
.modal-close:hover {
    background: #f1f5f9;
    color: var(--tbx-color-text-secondary);
}
#templatePreviewModal .modal-preview-download { display: none; }
#templatePreviewModal .modal-preview-download.visible { display: inline-flex; }
.docx-wrapper {
    background: #e8e8e8;
    padding: 16px;
    min-height: 50vh;
}
.btn-preview-inline {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--tbx-primary);
    font-size: inherit;
    font-family: inherit;
    text-decoration: none;
}
.btn-preview-inline:hover { text-decoration: underline; }
