* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "Microsoft YaHei", sans-serif; background: #f3f5f7; color: #1f2937; min-height: 100vh; background-size: cover; background-position: center; background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0; background: rgba(243,245,247,.72); z-index: -1; pointer-events: none; }
.app { max-width: 1180px; margin: 0 auto; padding: 24px; }
header { margin-bottom: 20px; }
h1 { margin: 0 0 8px; font-size: 30px; }
p { margin: 0; }
.panel { background: rgba(255,255,255,.92); border-radius: 14px; padding: 18px; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.06); backdrop-filter: blur(8px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
h2 { margin: 0 0 14px; font-size: 20px; }
label { display: block; margin: 12px 0 6px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid #d1d5db; border-radius: 10px; padding: 11px 12px; font-size: 15px; outline: none; }
input:focus, textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { min-height: 140px; resize: vertical; font-family: Consolas, monospace; }
.buttons { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
button { border: 0; border-radius: 10px; padding: 10px 16px; background: #2563eb; color: white; font-weight: 700; cursor: pointer; }
button:hover { opacity: .9; }
button.secondary { background: #e5e7eb; color: #111827; }
button.danger { background: #dc2626; }
.hint { color: #6b7280; font-size: 14px; margin-bottom: 10px; }
.message { margin-top: 10px; color: #2563eb; font-weight: 700; }
.matchBox { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.resultArea textarea { min-height: 180px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.tableWrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { border-bottom: 1px solid #e5e7eb; padding: 10px; text-align: left; }
th { background: #f9fafb; }
td.actions { white-space: nowrap; }
td.actions button { padding: 7px 10px; margin-right: 6px; }
.empty { text-align: center; color: #6b7280; padding: 22px; }
@media (max-width: 800px) { .grid2, .matchBox { grid-template-columns: 1fr; } .app { padding: 14px; } }

.selectionBar { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; color: #374151; }
.checkLabel { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; }
.checkLabel input, .rowCheck, #selectAllCheck { width: auto; box-shadow: none; }
.checkCol { width: 70px; }
button:disabled { opacity: .45; cursor: not-allowed; }


.filterBox { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; align-items: end; margin-bottom: 14px; }
.filterBox label { margin: 0 0 7px; font-size: 15px; }
.bigFilterInput { min-height: 50px; font-size: 18px; padding: 14px 16px; border-radius: 12px; }
.dateFilters { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.dateFilters input { min-height: 50px; font-size: 16px; }
.filterClearBtn { height: 50px; white-space: nowrap; }
@media (max-width: 900px) { .filterBox, .dateFilters { grid-template-columns: 1fr; } .filterClearBtn { width: 100%; } }


.backgroundPanel .toolbar { align-items: center; }
.backgroundButtons { margin-top: 0; justify-content: flex-end; }
.uploadBtn { display: inline-flex; align-items: center; margin: 0; border-radius: 10px; padding: 10px 16px; background: #2563eb; color: white; font-weight: 700; cursor: pointer; }
.uploadBtn:hover { opacity: .9; }
@media (max-width: 700px) { .backgroundButtons { justify-content: flex-start; } }

.inventoryStats { color: #6b7280; font-weight: 700; margin-top: -8px; }
.indexCol { width: 62px; }
.indexCell { color: #6b7280; font-weight: 700; }
.sortHeader { background: transparent; color: #1f2937; padding: 0; border-radius: 0; font: inherit; font-weight: 800; display: inline-flex; gap: 6px; align-items: center; }
.sortHeader:hover { opacity: .75; }
.copyCell { cursor: pointer; }
.copyCell:hover { background: #eff6ff; }

.batchSkuBox { margin-top: 12px; padding-top: 4px; }
.smallTextarea { min-height: 110px; }

/* v13: matching area cleanup */
.matchBox { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.matchPane { border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; background: #fbfdff; }
.matchPane label { margin: 0 0 10px; font-size: 16px; }
.matchPane textarea { min-height: 190px; border-radius: 12px; line-height: 1.65; font-size: 16px; white-space: pre; overflow: auto; background: #fff; }
#matchResult { font-size: 15px; }
.resultArea .buttons { justify-content: flex-start; }
.tableWrap { border: 1px solid #eef2f7; border-radius: 12px; }
table { min-width: 920px; }
th, td { padding: 12px 12px; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; }
td:nth-child(4) { font-family: Consolas, "Courier New", monospace; }
.toolbar h2 { margin-bottom: 0; }
.inventoryStats { margin: 0; }
@media (max-width: 800px) { .matchBox { grid-template-columns: 1fr; } }

/* v15: matching result table and cleaner layout */
.matchPanel { padding: 20px; }
.matchToolbar { align-items: flex-start; }
.matchStats { color: #2563eb; font-weight: 800; background: #eff6ff; border: 1px solid #bfdbfe; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.resultHeader { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.resultHeader label { margin: 0; }
.matchPane textarea { min-height: 210px; }
.miniBar { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: #6b7280; font-size: 13px; }
.textBtn { background: transparent; color: #6b7280; padding: 4px 6px; border-radius: 6px; }
.textBtn:hover { background: #eef2ff; color: #2563eb; }
.matchTableWrap { border: 1px solid #e5e7eb; border-radius: 12px; overflow: auto; min-height: 210px; background: white; }
.matchTable { min-width: 680px; }
.matchTable th, .matchTable td { padding: 10px 12px; font-size: 14px; }
.matchTable th { background: #f8fafc; font-weight: 800; }
.mono { font-family: Consolas, "Courier New", monospace; }
.muted { color: #9ca3af; }
.tag { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.tagExact { background: #dcfce7; color: #166534; }
.tagSuffix { background: #dbeafe; color: #1d4ed8; }
.tagContains { background: #ffedd5; color: #9a3412; }
.tagNone { background: #f3f4f6; color: #6b7280; }
.otherDetails summary { cursor: pointer; color: #2563eb; font-weight: 800; }
.otherItem { display: grid; grid-template-columns: minmax(90px, 1fr) 90px 52px; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #e5e7eb; }
.otherItem:last-child { border-bottom: 0; }
.otherItem em { font-style: normal; color: #6b7280; }
@media (max-width: 800px) { .matchStats { width: 100%; text-align: center; } }

/* auth / topbar */
.hidden { display: none !important; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.topbarUser { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbarUser strong { font-weight: 800; }
.warehouseSelect { width: auto; min-width: 160px; }
.topbarActions { display: flex; align-items: center; gap: 10px; }
.topbarActions a { color: #2563eb; font-weight: 700; text-decoration: none; }
.topbarActions a:hover { text-decoration: underline; }
.authGate { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f3f5f7; }
.authCard { background: white; border-radius: 14px; padding: 32px 36px; box-shadow: 0 8px 24px rgba(0,0,0,.08); text-align: center; max-width: 360px; }
.authCard h2 { margin: 0 0 10px; }
.authCard p { margin: 0 0 18px; color: #6b7280; }
.authCard a.uploadBtn { display: inline-flex; }

/* language switch */
.lang-switch { display: inline-flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; }
.lang-btn { padding: 5px 9px; font-size: 12px; font-weight: 700; line-height: 1; background: #fff; color: #6b7280; border: 0; cursor: pointer; font-family: inherit; border-left: 1px solid #d1d5db; }
.lang-btn:first-child { border-left: 0; }
.lang-btn.active { background: #2563eb; color: #fff; }
