*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;background:#f0f2f5;color:#1a1a2e;font-size:13px;line-height:1.5;min-height:100vh}
#upload-screen{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:20px}
.up-card{background:white;border-radius:20px;padding:52px 44px;text-align:center;width:100%;max-width:430px;box-shadow:0 2px 28px rgba(0,0,0,.08)}
.up-icon{font-size:42px;margin-bottom:16px}
.up-card h1{font-size:22px;font-weight:700;color:#111827;margin-bottom:8px}
.up-card>p{color:#9ca3af;font-size:13px;margin-bottom:28px}
.drop-zone{border:2px dashed #e5e7eb;border-radius:12px;padding:36px 20px;cursor:pointer;transition:all .2s;position:relative}
.drop-zone:hover,.drop-zone.drag{border-color:#818cf8;background:#f5f3ff}
.drop-zone input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.drop-zone p{color:#6b7280;font-size:13px;pointer-events:none}
.drop-zone p span{color:#6366f1;font-weight:600}
.drop-zone small{color:#b0b8c8;font-size:11px;margin-top:4px;display:block}

#main-screen{display:none;height:100vh;min-height:0;overflow:hidden;flex-direction:column;position:relative}
.is-hidden{display:none!important}
.topbar{background:white;border-bottom:1px solid #f0f0f0;padding:0 20px;height:52px;display:flex;align-items:center;gap:16px;position:sticky;top:0;z-index:50;box-shadow:0 1px 6px rgba(0,0,0,.04)}
.tb-info{flex:1;min-width:0;display:flex;align-items:baseline;gap:10px}
.tb-title{font-size:14px;font-weight:600;color:#111827;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tb-sub{font-size:11px;color:#9ca3af;white-space:nowrap;flex-shrink:0}
.tb-ctrl{display:flex;align-items:center;gap:14px;flex-shrink:0}
.sw-wrap{display:flex;align-items:center;gap:5px;font-size:12px;color:#6b7280;cursor:pointer;user-select:none}
.sw{position:relative;width:30px;height:17px}
.sw input{opacity:0;width:0;height:0;position:absolute}
.sw-t{position:absolute;inset:0;background:#d1d5db;border-radius:17px;transition:.2s;cursor:pointer}
.sw-t::before{content:'';position:absolute;width:13px;height:13px;left:2px;top:2px;background:white;border-radius:50%;transition:.2s;box-shadow:0 1px 2px rgba(0,0,0,.2)}
.sw input:checked~.sw-t{background:#6366f1}
.sw input:checked~.sw-t::before{transform:translateX(13px)}

.tablebar{background:white;border-bottom:1px solid #f0f0f0;padding:6px 20px;display:flex;align-items:center;gap:10px;position:sticky;top:52px;z-index:48}
.mode-tabs{background:#f3f4f6;border-radius:8px;padding:2px;display:flex;gap:1px;flex:1;max-width:max-content}
.tab{padding:4px 14px;border-radius:6px;font-size:12px;font-weight:500;border:none;background:transparent;color:#6b7280;cursor:pointer;transition:all .15s}
.tab.on{background:white;color:#111827;box-shadow:0 1px 3px rgba(0,0,0,.1)}
.name-options{display:flex;align-items:center;gap:8px;min-width:0;flex:1}
.name-field{display:flex;align-items:center;gap:5px;color:#6b7280;font-size:12px;min-width:0}
.name-field span{white-space:nowrap}
.name-field input{width:96px;height:28px;border:1px solid #e5e7eb;border-radius:7px;background:#fafafa;color:#111827;font:inherit;padding:4px 8px;outline:none;transition:all .15s}
.name-field input:focus{background:white;border-color:#6366f1;box-shadow:0 0 0 2px rgba(99,102,241,.1)}
.filterbar{background:white;border-bottom:1px solid #f0f0f0;padding:8px 20px;display:flex;align-items:center;justify-content:space-between;gap:14px;position:sticky;top:93px;z-index:45}
.search-box{position:relative;width:min(420px,100%);flex:1;max-width:420px}
.search-mark{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:#9ca3af;font-size:15px;line-height:1;pointer-events:none}
.search-input{width:100%;height:32px;border:1px solid #e5e7eb;border-radius:7px;padding:5px 34px 5px 30px;background:#fafafa;color:#111827;font:inherit;outline:none;transition:all .15s}
.search-input:focus{background:white;border-color:#6366f1;box-shadow:0 0 0 2px rgba(99,102,241,.1)}
.icon-btn{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:22px;height:22px;border:none;border-radius:5px;background:transparent;color:#9ca3af;font-size:16px;line-height:1;cursor:pointer;transition:all .15s}
.icon-btn:hover{background:#f3f4f6;color:#374151}
.filter-stats{display:flex;align-items:center;gap:8px;min-width:0;color:#9ca3af;font-size:11px;white-space:nowrap}

.btn{padding:5px 13px;border-radius:7px;font-size:12px;font-weight:500;border:none;cursor:pointer;transition:all .15s;white-space:nowrap}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-pri{background:#6366f1;color:white}
.btn-pri:hover:not(:disabled){background:#4f46e5}
.btn-gho{background:#f3f4f6;color:#374151}
.btn-gho:hover:not(:disabled){background:#e5e7eb}
.btn-red{background:#fef2f2;color:#dc2626}
.btn-red:hover{background:#fee2e2}

.err-banner{background:#fff8f8;border-left:3px solid #f87171;padding:10px 16px;margin:12px 20px 0;border-radius:6px;font-size:12px;color:#b91c1c;display:none;line-height:1.8}
.t-area{flex:1;min-height:0;padding:16px 20px;overflow:hidden;display:grid;grid-template-columns:minmax(260px,340px) 1fr;gap:14px}
.side-card,.preview-card{height:100%;background:white;border-radius:12px;overflow:hidden;box-shadow:0 1px 6px rgba(0,0,0,.05)}
.sheet-list{height:100%;overflow:auto;padding:12px;display:flex;flex-direction:column;gap:9px}
.sheet-item{border:1px solid #e5e7eb;border-radius:8px;background:#fafafa;padding:11px;display:flex;align-items:flex-start;justify-content:space-between;gap:10px;transition:all .15s;cursor:pointer}
.sheet-item:hover{background:#fdfdfd;border-color:#c7d2fe}
.sheet-item.active{border-color:#818cf8;background:#f5f3ff}
.sheet-main{min-width:0}
.sheet-name{font-size:13px;font-weight:600;color:#111827;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:4px}
.sheet-meta{font-size:11px;color:#9ca3af}
.sheet-badge{font-size:11px;color:#6366f1;background:#eef2ff;border-radius:999px;padding:2px 8px;flex-shrink:0}
.empty-st{text-align:center;padding:48px 20px;color:#9ca3af;font-size:13px}
.preview-card{display:flex;flex-direction:column}
.preview-head{height:48px;border-bottom:1px solid #f0f0f0;padding:8px 12px;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0}
.preview-head strong{display:block;font-size:13px;color:#111827;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:54vw}
.preview-head span{display:block;font-size:11px;color:#9ca3af;margin-top:2px}
.preview-scroll{flex:1;min-height:0;overflow:auto}
table{border-collapse:collapse;width:max-content;min-width:100%;font-size:12px}
td{border:1px solid #edf0f5;padding:6px 8px;min-width:88px;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#374151;background:white}
tr:nth-child(-n+5) td{background:#fafafa;font-weight:600;color:#111827}
td.marker{background:#eef2ff!important;color:#4f46e5;font-weight:700;min-width:78px}
td.ignored{color:#9ca3af;background:#fbfbfd}
.bbar{background:white;border-top:1px solid #f0f0f0;padding:10px 20px;display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;bottom:0;flex-shrink:0}
.bbar-l,.bbar-r{display:flex;align-items:center;gap:8px}
.status-txt{font-size:11px;color:#9ca3af}

.drop-overlay{position:absolute;inset:0;z-index:80;background:rgba(240,242,245,.74);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;padding:20px}
.drop-overlay-box{border:2px dashed #818cf8;border-radius:14px;background:white;box-shadow:0 8px 30px rgba(0,0,0,.12);padding:30px 36px;text-align:center;color:#111827}
.drop-overlay-box strong{display:block;font-size:18px;margin-bottom:6px}
.drop-overlay-box span{font-size:12px;color:#9ca3af}

@media(max-width:820px){
  .t-area{grid-template-columns:1fr;grid-template-rows:210px 1fr;padding:12px}
  .preview-head strong{max-width:78vw}
}
@media(max-width:640px){
  .topbar{padding:0 12px;gap:8px}
  .tablebar{top:52px;padding:6px 12px;flex-wrap:wrap}
  .name-options{order:3;flex-basis:100%}
  .name-field{flex:1}
  .name-field input{width:100%;min-width:0}
  .filterbar{top:128px;padding:8px 12px;align-items:flex-start;flex-direction:column;gap:6px}
  .search-box{max-width:none}
  .tb-sub{display:none}
  .up-card{padding:32px 20px}
}
