/* ==================== 基础样式 ==================== */
:root {
    --el-color-primary: #2563eb;
}

* {
    box-sizing: border-box;
}

[v-cloak] {
    display: none;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #1f2937;
    font-size: 14px;
}

a {
    color: #2563eb;
    text-decoration: none;
}

/* ==================== 顶部导航 ==================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 1320px;
    height: 60px;
    margin: 0 auto;
    padding: 0 20px;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #1d4ed8;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    flex: 1;
    gap: 6px;
}

.main-nav a {
    padding: 8px 14px;
    border-radius: 8px;
    color: #374151;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.main-nav a:hover {
    background: #f1f5f9;
}

.main-nav a.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #4b5563;
    font-size: 13px;
    white-space: nowrap;
}

.userbox .role {
    padding: 2px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
}

.userbox .logout {
    color: #6b7280;
}

.userbox .logout:hover {
    color: #dc2626;
}

/* ==================== 页面容器 ==================== */
.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.page-card {
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.page-head .sub {
    margin-left: 10px;
    color: #8a94a6;
    font-size: 13px;
    font-weight: 400;
}

.head-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.muted {
    color: #9ca3af;
    font-size: 12px;
}

/* ==================== 登录页 ==================== */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #eef4ff 0%, #f8fafc 55%, #eef7ff 100%);
}

.login-card {
    width: 400px;
    max-width: 100%;
    padding: 36px 34px 30px;
    background: #ffffff;
    border: 1px solid #e6ebf5;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
}

.login-title {
    margin: 0 0 6px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.login-sub {
    margin: 0 0 26px;
    text-align: center;
    color: #8a94a6;
    font-size: 13px;
}

.login-footer {
    margin-top: 22px;
    color: #9ca3af;
    font-size: 12px;
}

/* ==================== 账单表单 ==================== */
.form-card {
    max-width: 860px;
    margin: 0 auto;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.section-label {
    margin-bottom: 10px;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
}

.existing-images {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 16px;
}

.existing-item {
    width: 150px;
    padding: 8px;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.existing-item img {
    display: block;
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

.existing-item .file-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    border-radius: 4px;
    background: #fff1f2;
    color: #e11d48;
    font-size: 15px;
    font-weight: 700;
}

.existing-item .meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
}

/* ==================== 打印页 ==================== */
.print-body {
    margin: 0;
    background: #eef1f5;
}

.print-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 16px;
}

.print-toolbar button,
.print-toolbar a {
    padding: 8px 20px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
}

.print-toolbar button.primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.print-toolbar button:hover,
.print-toolbar a:hover {
    opacity: 0.86;
}

.print-area {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 32px;
    padding: 15mm 16mm;
    background: #ffffff;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.12);
    font-size: 13px;
    color: #222222;
}

/* 导出 PDF 时收窄到 A4 可打印宽度，避免缩放和多余空白页 */
.print-area.exporting {
    width: 190mm;
    min-height: auto;
    padding: 0;
    box-shadow: none;
}

.print-head {
    padding-bottom: 12px;
    border-bottom: 2px solid #222222;
    text-align: center;
}

.print-head h1 {
    margin: 0 0 10px;
    font-size: 24px;
    letter-spacing: 6px;
}

.print-meta {
    display: flex;
    justify-content: space-between;
    color: #555555;
    font-size: 12px;
}

.doc-table {
    width: 100%;
    margin-top: 16px;
    border-collapse: collapse;
}

.doc-table th,
.doc-table td {
    padding: 8px 10px;
    border: 1px solid #555555;
    font-size: 13px;
    line-height: 1.6;
    text-align: left;
    vertical-align: top;
}

.doc-table th {
    width: 90px;
    background: #f2f4f7;
    font-weight: 600;
}

.doc-table .amount {
    font-size: 16px;
    font-weight: 700;
}

.status-text.pending {
    color: #b45309;
}

.status-text.approved {
    color: #15803d;
}

.status-text.rejected {
    color: #b91c1c;
}

.attachments {
    margin-top: 24px;
}

.attachment-title {
    margin-bottom: 12px;
    padding-left: 8px;
    border-left: 4px solid #2563eb;
    font-size: 14px;
    font-weight: 600;
}

.attachment-item {
    margin-bottom: 16px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.attachment-item img {
    display: block;
    max-width: 100%;
    max-height: 235mm;
    margin: 0 auto;
    border: 1px solid #dddddd;
}

.pdf-box {
    padding: 16px;
    border: 1px dashed #9ca3af;
    border-radius: 4px;
    font-size: 13px;
}

.pdf-box .pdf-name {
    margin-bottom: 8px;
    word-break: break-all;
}

.attachments .empty {
    padding: 16px;
    border: 1px dashed #d1d5db;
    color: #9ca3af;
    text-align: center;
}

.sign-row {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    font-size: 13px;
}

/* ==================== 升级提示 / 升级页 ==================== */
.upgrade-banner {
    padding: 10px 20px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    color: #92400e;
    text-align: center;
    font-size: 13px;
}

.upgrade-banner a {
    color: #b45309;
    font-weight: 600;
    text-decoration: underline;
}

.upgrade-card {
    max-width: 760px;
    margin: 0 auto;
}

.status-box {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.8;
}

.status-box.ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.status-box.warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.upgrade-list {
    margin: 0 0 22px;
    padding-left: 20px;
    color: #374151;
    font-size: 13px;
    line-height: 2;
}

.primary-btn,
.secondary-btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

.primary-btn {
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.primary-btn:hover {
    opacity: 0.9;
}

.secondary-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
}

.secondary-btn:hover {
    background: #f9fafb;
}

/* ==================== 基础设置 ==================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.setting-card {
    min-width: 0;
}

.setting-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.setting-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.setting-add {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.setting-add .el-input {
    flex: 1;
}

.setting-tip {
    margin-bottom: 12px;
    color: #9ca3af;
    font-size: 12px;
}

/* ==================== 列表筛选 / 票据预览 ==================== */
.amount-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.amount-input {
    width: 110px;
}

.range-sep {
    color: #9ca3af;
}

.thumb-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    cursor: zoom-in;
}

.thumb-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

.thumb-count {
    position: absolute;
    right: -4px;
    bottom: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: rgba(31, 41, 55, 0.82);
    color: #ffffff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.pagination-bar {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.preview-item + .preview-item {
    margin-top: 16px;
}

.preview-img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: zoom-in;
}

.preview-pdf {
    background: #fafafa;
}

.preview-empty {
    padding: 30px;
    text-align: center;
    color: #9ca3af;
}

@media (max-width: 1000px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

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

    body,
    .print-body {
        background: #ffffff;
    }

    .print-area {
        width: auto;
        min-height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    @page {
        size: A4;
        margin: 14mm;
    }

    .attachment-item {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* ==================== 小屏适配 ==================== */
@media (max-width: 768px) {
    .topbar-inner {
        gap: 12px;
        height: auto;
        padding: 10px 14px;
        flex-wrap: wrap;
    }

    .main-nav {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto;
    }

    .userbox {
        margin-left: auto;
    }

    .page {
        padding: 16px 12px 32px;
    }

    .print-area {
        width: 100%;
        min-height: auto;
        padding: 20px 16px;
    }

    .print-toolbar {
        flex-wrap: wrap;
    }
}
