* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "Microsoft YaHei", sans-serif; color: #1f2937; background: #f5f7fb; }
a { color: #1457a8; text-decoration: none; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: #ffffff; border-bottom: 1px solid #d9e1ec; }
.topbar strong { display: block; font-size: 18px; }
.topbar span { color: #607084; font-size: 13px; }
.layout { display: flex; gap: 18px; padding: 22px; max-width: 1800px; margin: 0 auto; }
.panel { background: #ffffff; border: 1px solid #d9e1ec; border-radius: 8px; padding: 22px; margin-bottom: 18px; width: 100%; }
.wide { flex: 1; min-width: 0; }
.sidebar { width: 260px; flex: 0 0 260px; background: #ffffff; border: 1px solid #d9e1ec; border-radius: 8px; padding: 16px; height: max-content; }
.sidebar a { display: block; padding: 9px 10px; border-radius: 6px; color: #334155; }
.sidebar a.active, .sidebar a:hover { background: #eaf2ff; color: #104b91; }
h1 { margin: 0 0 14px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 18px; }
p { margin: 0; color: #607084; }
.grid-form { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)) auto; gap: 12px; align-items: end; }
label { display: grid; gap: 6px; font-size: 13px; color: #465468; }
input { width: 100%; height: 36px; border: 1px solid #c9d3e2; border-radius: 6px; padding: 6px 9px; font: inherit; background: #fff; }
input[type="checkbox"] { width: 18px; height: 18px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border: 0; border-radius: 6px; background: #155eb5; color: #fff; font-weight: 600; cursor: pointer; }
.button.secondary { background: #5b6778; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid #e3e9f2; padding: 12px 14px; text-align: left; vertical-align: middle; }
th { background: #f0f4fa; color: #405064; font-size: 13px; white-space: nowrap; }
td code { color: #516173; font-size: 12px; white-space: normal; }
output { display: inline-block; min-width: 120px; font-weight: 700; color: #0f5132; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; min-width: 130px; flex: 1; height: 34px; }
.inline-form button { white-space: nowrap; }
.inline-form input[type=password] { min-width: 130px; }
.notice { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #b9d5ff; border-radius: 6px; background: #eef6ff; color: #174a7c; }
.notice.success { border-color: #b8e6c8; background: #e8f8ef; color: #0b5e2e; }
.import-panel { margin: 0 0 18px; border: 1px solid #d9e1ec; border-radius: 8px; background: #fff; }
.import-panel summary { padding: 12px 16px; cursor: pointer; font-weight: 600; color: #155eb5; }
.import-panel[open] summary { border-bottom: 1px solid #d9e1ec; }
.import-fields { display: flex; gap: 14px; padding: 16px; flex-wrap: wrap; }
.import-fields label { flex: 1; min-width: 180px; }
.import-fields span { display: block; font-weight: 600; color: #1f2937; margin-bottom: 4px; }
.import-fields input[type="file"] { height: auto; padding: 6px; }
.form-actions { position: sticky; bottom: 0; padding: 12px 0 0; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 35%); }
.excel-wrap { width: 100%; max-height: calc(100vh - 210px); overflow: auto; border: 1px solid #aeb8c6; background: #ffffff; }
.excel-sheet { width: max-content; min-width: 100%; table-layout: fixed; border-collapse: collapse; background: #ffffff; }
.excel-sheet col { width: 104px; }
.excel-sheet .excel-cell { min-width: 80px; height: 30px; padding: 3px 6px; border: 1px solid #9faabc; color: #111827; font-size: 12px; line-height: 1.25; white-space: pre-wrap; vertical-align: middle; background: #fff; }
.excel-sheet .bold { font-weight: 700; }
.excel-sheet .center { text-align: center; }
.excel-sheet .middle { vertical-align: middle; }
.excel-sheet .filled { background: #eef3fb; }
.excel-sheet .data-cell { background: #fffdf2; }
.excel-sheet .readonly-sheet.data-cell { background: #f3f6fa; }
.excel-sheet output { display: block; min-width: 0; width: 100%; color: #0f5132; font-weight: 700; text-align: right; }
.excel-input { height: 24px; min-width: 72px; border: 1px solid #7aa7e8; border-radius: 0; padding: 2px 4px; font-size: 12px; text-align: right; background: #fffefa; }
.excel-checkbox { width: 16px; height: 16px; margin: 0 auto; display: block; }
.excel-sheet td:first-child, .excel-sheet tr:first-child td { background-color: #f7f9fc; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; margin: 18px 0 24px; }
.kpis div { border: 1px solid #d9e1ec; border-radius: 8px; padding: 14px; background: #f8fbff; }
.kpis span { display: block; color: #607084; font-size: 13px; margin-bottom: 8px; }
.kpis strong { font-size: 22px; }
.sheet-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.sheet-list a { border: 1px solid #d9e1ec; border-radius: 8px; padding: 14px; background: #ffffff; }
.sheet-list strong, .sheet-list span { display: block; }
.sheet-list span { margin-top: 6px; color: #4b5c70; }
.print-body { background: #ffffff; color: #000; }
.print-toolbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid #d1d5db; background: #fff; }
.print-sheet { background: #fff; padding: 18px; break-after: page; page-break-after: always; }
.print-sheet h1 { text-align: center; font-size: 18px; margin: 0 0 10px; color: #000; }
.print-sheet .excel-wrap { max-height: none; overflow: visible; border: 0; }
.print-sheet .excel-sheet { width: 100%; min-width: 0; table-layout: fixed; }
.print-sheet .excel-sheet col { width: auto; }
.print-sheet .excel-sheet .excel-cell { height: auto; padding: 2px 4px; border: 1px solid #000; font-size: 10px; color: #000; background: #fff; }
.print-sheet .excel-sheet output { color: #000; font-weight: 400; }
@media (max-width: 900px) {
    .layout { display: block; padding: 14px; }
    .sidebar { width: auto; margin-bottom: 14px; }
    .grid-form, .kpis { grid-template-columns: 1fr; }
    .toolbar { display: block; }
}
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    body { background: #fff; }
    .topbar, .sidebar, .toolbar, .print-toolbar, .form-actions, .notice { display: none !important; }
    .layout { display: block; max-width: none; padding: 0; }
    .panel { border: 0; padding: 0; margin: 0; }
    .print-sheet { padding: 0; break-after: page; page-break-after: always; }
    .print-sheet:last-child { break-after: auto; page-break-after: auto; }
    .excel-wrap { overflow: visible !important; max-height: none !important; border: 0; }
    .excel-sheet { width: 100% !important; min-width: 0 !important; table-layout: fixed; border-collapse: collapse; }
    .excel-sheet .excel-cell { border: 1px solid #000 !important; color: #000 !important; background: #fff !important; font-size: 9px; padding: 1.5px 3px; }
    .excel-input, .excel-checkbox { border: 0; outline: 0; background: transparent; color: #000; }
    output { color: #000 !important; }
}
