/* 基础样式 */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f3f4f6;
}

/* 容器 */
.max-w-5xl {
    max-width: 64rem;
    margin: 0 auto;
    padding: 1rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* 文本样式 */
.text-center {
    text-align: center;
}

.text-xl {
    font-size: 1.25rem;
}

.font-bold {
    font-weight: 700;
}

.text-gray-500 {
    color: #6b7280;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-red-500 {
    color: #ef4444;
}

.text-green-500 {
    color: #22c55e;
}

.text-blue-500 {
    color: #3b82f6;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-5 {
    margin-bottom: 1.25rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.ml-4 {
    margin-left: 1rem;
}

/* 背景和卡片 */
.bg-white {
    background-color: #ffffff;
}

.bg-gray-50 {
    background-color: #f9fafb;
}

.bg-red-50 {
    background-color: #fef2f2;
}

.bg-green-50 {
    background-color: #f0fdf4;
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.border {
    border-width: 1px;
}

.border-2 {
    border-width: 2px;
}

.border-gray-500 {
    border-color: #6b7280;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.border-red-200 {
    border-color: #fecaca;
}

.border-green-200 {
    border-color: #bbf7d0;
}

.border-blue-200 {
    border-color: #bfdbfe;
}

.border-dashed {
    border-style: dashed;
}

.border-gray-400 {
    border-color: #9ca3af;
}

/* 阴影 */
.shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* 内边距 */
.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-5 {
    padding: 1.25rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* 按钮样式 */
.btn-hover {
    transition: all 0.3s ease;
    border: none;
}

.btn-hover:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.bg-green-600 {
    background-color: #16a34a;
}

.bg-gray-500 {
    background-color: #6b7280;
}

.bg-teal-600 {
    background-color: #0d9488;
}

.bg-blue-600 {
    background-color: #2563eb;
}

.bg-purple-600 {
    background-color: #9333ea;
}

.text-white {
    color: #ffffff;
}

/* 按钮和输入框 */
button, input[type="file"] {
    cursor: pointer;
}

.w-full {
    width: 100%;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.rounded {
    border-radius: 0.25rem;
}

.rounded-full {
    border-radius: 9999px;
}

/* 输入框焦点 */
.input-focus {
    outline: none;
}

.input-focus:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    border-color: #3b82f6;
}

/* Flex 布局 */
.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-12 {
    gap: 3rem;
}

/* 位置 */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.left-0 {
    left: 0;
}

.left-1/2 {
    left: 50%;
}

.top-0 {
    top: 0;
}

.transform {
    transform: translateX(-50%);
}

/* 显示隐藏 */
.hidden {
    display: none;
}

/* 表格样式 */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-cell {
    border: 1px solid #9ca3af;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    text-align: center;
}

.table-th-cell {
    border: 1px solid #9ca3af;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    background-color: #f3f4f6;
    text-align: center;
}

.bg-gray-100 {
    background-color: #f3f4f6;
}

.w-10 {
    width: 2.5rem;
}

/* 序号列宽度 - 刚好显示两位数 */
.col-seq {
    width: 2.2rem;
    min-width: 2.2rem;
    max-width: 2.2rem;
    white-space: nowrap;
}

/* 制作单表格：总宽固定 204mm，列宽均分 */
#printArea table {
    width: 204mm;
    table-layout: fixed;
}

/* 打印样式 */
@media print {
    body * {
        visibility: hidden;
    }
    #printArea, #printArea * {
        visibility: visible;
    }
    #printArea {
        position: absolute;
        left: 0;
        top: 0;
    }
}

/* 响应式 */
@media (max-width: 768px) {
    .table-wrapper {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    .table-wrapper table {
        min-width: 640px;
    }
}

/* 打印区域头部布局 */
.print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    position: relative;
}

.header-left {
    flex: 1;
    min-width: 120px;
}

.title-main {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    flex: 0 0 auto;
    margin: 0;
    letter-spacing: 0.5rem;
    padding-left: 0.5rem;
}

.header-right {
    flex: 1;
    min-width: 120px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 产品类型标签样式 */
.type-tag {
    border: 2px solid #374151;
    color: #374151;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 14px;
    background-color: #f9fafb;
}

/* 标签样式 */
.tag-red {
    border: 2px solid #dc2626;
    color: #dc2626;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fef2f2;
}

.tag-green {
    border: 2px solid #16a34a;
    color: #16a34a;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    background-color: #f0fdf4;
}

.tag-blue {
    border: 2px solid #2563eb;
    color: #2563eb;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    background-color: #eff6ff;
}

/* Font Awesome 基础样式 */
.fa {
    display: inline-block;
    font-family: 'FontAwesome';
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Font Awesome 图标 - 使用 Unicode 替代 */
.fa-print:before { content: "🖨️"; }
.fa-trash:before { content: "🗑️"; }
.fa-upload:before { content: "📤"; }
.fa-download:before { content: "📥"; }
.fa-history:before { content: "📜"; }
.fa-spinner:before { content: "⚙️"; }
.fa-spin {
    animation: fa-spin 2s infinite linear;
}
@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(359deg); }
}
.fa-exclamation-circle:before { content: "⚠️"; }
.fa-check-circle:before { content: "✅"; }
.fa-info-circle:before { content: "ℹ️"; }
.fa-times:before { content: "✕"; }

/* ===== 拼版参数输入区 ===== */
.calc-params {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
}

.param-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.param-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.param-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.param-input {
    width: 5rem;
    padding: 0.375rem 0.625rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.param-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.param-input-short {
    width: 4rem;
}

.param-unit {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

/* ===== 拼版计算结果 ===== */
.calc-result {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 0.625rem;
    padding: 0.75rem 1rem;
}

.calc-result-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #4338ca;
}

.calc-result-icon {
    width: 1rem;
    height: 1rem;
}

.calc-table {
    display: flex;
    flex-direction: column;
}

.calc-row {
    display: flex;
    border-bottom: 1px dashed #c7d2fe;
}

.calc-row:first-child {
    border-top: 1px solid #c7d2fe;
}

.calc-cell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.75rem;
    border-right: 1px solid #e0e7ff;
    min-width: 0;
}

.calc-cell:last-child {
    border-right: none;
}

.calc-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    margin-right: 0.375rem;
    flex-shrink: 0;
}

.calc-value {
    font-size: 0.9375rem;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.c-blue  { color: #2563eb; }
.c-purple{ color: #7c3aed; }
.c-green { color: #059669; }
.c-indigo{ color: #4f46e5; }
.c-orange{ color: #ea580c; }
.c-red   { color: #dc2626; }
.c-teal  { color: #0d9488; }
.c-gray  { color: #64748b; }

.calc-warn-panel {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.calc-warn-mismatch {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.calc-warn-match {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.calc-warn-panel.calc-warn-mismatch #warnIconMatch { display: none; }
.calc-warn-panel.calc-warn-mismatch #warnIconMismatch { display: block; }
.calc-warn-panel.calc-warn-match #warnIconMatch { display: block; }
.calc-warn-panel.calc-warn-match #warnIconMismatch { display: none; }

.calc-warn-icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

/* ===== 状态选择 Chip ===== */
.status-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #475569;
    margin-right: 0.25rem;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.status-chip:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.status-chip input[type="checkbox"] {
    display: none;
}

.status-chip span {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #94a3b8;
    transition: color 0.2s;
}

.status-urgent:has(input:checked) {
    border-color: #fca5a5;
    background: #fef2f2;
}
.status-urgent:has(input:checked) span {
    color: #dc2626;
}

.status-self:has(input:checked) {
    border-color: #86efac;
    background: #f0fdf4;
}
.status-self:has(input:checked) span {
    color: #16a34a;
}

.status-mail:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
}
.status-mail:has(input:checked) span {
    color: #2563eb;
}

/* ===== 分隔线 ===== */
.section-divider {
    height: 1px;
    background: linear-gradient(to right, #e2e8f0, #cbd5e1 50%, #e2e8f0);
    border: none;
    margin: 0;
}

/* ===== 响应式：拼版表格小屏适配 ===== */
@media (max-width: 640px) {
    .calc-row {
        flex-wrap: wrap;
    }
    .calc-cell {
        flex: 1 1 50%;
        border-bottom: 1px solid #e0e7ff;
    }
    .calc-row:last-child .calc-cell {
        border-bottom: none;
    }
    .param-group {
        gap: 0.75rem;
    }
}
