/* SheetKit · 精致版 UI
 * 配色灵感:Linear / Vercel / Notion 现代工具站风格
 */
:root {
  /* 主色 — 精致祖母绿(贴合表格/数据处理主题) */
  --primary: #059669;          /* emerald-600 */
  --primary-hover: #047857;    /* emerald-700 */
  --primary-soft: #ecfdf5;     /* emerald-50 */
  --primary-deep: #064e3b;     /* emerald-900 */
  --primary-ring: rgba(5, 150, 105, 0.18);
  --primary-shadow: rgba(5, 150, 105, 0.28);

  /* 辅助色 */
  --accent: #0891b2;           /* cyan-600 */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* 中性色 */
  --bg: #fafafe;
  --bg-deep: #f4f4fb;
  --surface: #ffffff;
  --surface-soft: #fafbff;
  --border: #e7e9f3;
  --border-strong: #d1d5e0;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --muted-soft: #cbd5e1;

  /* 阴影系统 */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 0 4px var(--primary-ring);

  /* 圆角 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* 动画 */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ==================== Header ==================== */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.15s var(--ease);
}
.site-nav a:hover { color: var(--text); background: var(--bg-deep); }

/* ==================== Hero ==================== */
.main { padding: 40px 24px 80px; }
.hero {
  position: relative;
  text-align: center;
  margin-bottom: 32px;
  padding: 8px 0 4px;
}
.hero::before { display: none; }
.hero h1 {
  margin: 0 0 12px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hero p {
  margin: 0 auto;
  max-width: 640px;
  color: var(--text-soft);
  font-size: 16px;
}
.feature-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-soft);
  box-shadow: var(--shadow-xs);
}
.feature-chip svg { width: 14px; height: 14px; color: var(--primary); }

/* ==================== Tabs ==================== */
.mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: fit-content;
  margin: 0 auto 24px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.mode-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-soft);
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s var(--ease);
  font-family: inherit;
}
.mode-tab svg { width: 16px; height: 16px; }
.mode-tab:hover { color: var(--text); background: var(--bg-deep); }
.mode-tab.is-active {
  background: var(--primary);
  color: #fff;
}

/* ==================== Panel ==================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: none;
  animation: panelIn 0.25s var(--ease);
}
.panel.is-active { display: block; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.panel-title h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-title .hint {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

/* 示例加载快捷按钮 */
.sample-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  border: 1px solid #a7f3d0;             /* emerald-200 */
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
  white-space: nowrap;
  font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(5, 150, 105, 0.06);
}
.sample-loader:hover {
  background: #d1fae5;                    /* emerald-100 */
  border-color: #6ee7b7;                  /* emerald-300 */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 6px rgba(5, 150, 105, 0.12);
}
.sample-loader:active {
  background: #a7f3d0;
  box-shadow: inset 0 1px 2px rgba(5, 150, 105, 0.18);
}
.sample-loader svg { width: 14px; height: 14px; }

/* ==================== File Drop ==================== */
.upload-row { margin-bottom: 16px; }
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: var(--surface-soft);
  transition: all 0.18s var(--ease);
  text-align: center;
  position: relative;
}
.file-drop:hover, .file-drop.is-drag {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.file-drop:hover .drop-icon { transform: scale(1.05); color: var(--primary); }
.drop-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--primary);
  transition: all 0.2s var(--ease);
}
.drop-icon svg { width: 24px; height: 24px; }
.drop-text { font-weight: 600; font-size: 15px; color: var(--text); }
.drop-sub { color: var(--muted); font-size: 12px; }

/* ==================== File List ==================== */
.file-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.file-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.15s var(--ease);
}
.file-list li:hover { border-color: var(--primary); background: var(--primary-soft); }
.file-list li::before {
  content: '';
  width: 32px; height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-shrink: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23059669" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="9" y1="13" x2="15" y2="13"/><line x1="9" y1="17" x2="15" y2="17"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
}
.file-list .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-list .file-size { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.file-list .file-remove {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  font-family: inherit;
}
.file-list .file-remove:hover { color: var(--danger); background: #fef2f2; }

/* ==================== Meta cards ==================== */
.meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.meta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s var(--ease);
}
.meta-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.meta-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.meta-value { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }

/* ==================== Options ==================== */
.options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.opt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.opt-block { grid-column: 1 / -1; }
.opt.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 500;
}
.opt.checkbox input { accent-color: var(--primary); width: 16px; height: 16px; }

.select, .input {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: all 0.15s var(--ease);
}
.select:hover, .input:hover { border-color: var(--muted); }
.select:focus, .input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.select {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%2394a3b8" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* ==================== Chips ==================== */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  user-select: none;
  font-weight: 500;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-on {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==================== Buttons ==================== */
.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.action-label { font-size: 13px; color: var(--text-soft); margin-right: 4px; font-weight: 500; }

/* —— 次要按钮(默认):干净的描边白底,hover 时微微变深 —— */
.btn {
  appearance: none;
  position: relative;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease), box-shadow 0.12s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* 极轻的底部投影,提供"贴在画面上"的物理感 */
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:hover {
  border-color: var(--text-soft);
  background: var(--bg-deep);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 2px 6px rgba(15, 23, 42, 0.06);
}
.btn:active {
  background: var(--border);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow), 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* —— 主按钮:顶部内高光 + 色调阴影,Stripe / Linear 风格质感 —— */
.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),    /* 顶部高光,营造立体感 */
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),         /* 底部细微暗边,增加厚度 */
    0 1px 2px rgba(5, 150, 105, 0.28),          /* 紧贴的色调投影 */
    0 0 0 1px rgba(5, 150, 105, 0.08);          /* 同色微描边 */
}
.btn.primary:hover {
  background: var(--primary-hover);
  color: #fff;
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.20),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(5, 150, 105, 0.32),
    0 0 0 1px rgba(5, 150, 105, 0.10);
}
.btn.primary:active {
  background: var(--primary-deep);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.20),        /* 按下时内陷感 */
    0 0 0 1px rgba(5, 150, 105, 0.10);
}
.btn.primary:focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 1px 2px rgba(5, 150, 105, 0.28),
    0 0 0 4px var(--primary-ring);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==================== Preview ==================== */
.preview-wrap { margin-top: 20px; }
.preview-wrap h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.preview-wrap h3::before {
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.preview-scroll {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  max-height: 480px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.preview-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.preview-scroll::-webkit-scrollbar-track { background: var(--bg-deep); }
.preview-scroll::-webkit-scrollbar-thumb { background: var(--muted-soft); border-radius: 4px; }
.preview-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.preview-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}
.preview-table th, .preview-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-table th {
  background: var(--surface-soft);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-strong);
}
.preview-table tbody tr { transition: background 0.1s; }
.preview-table tbody tr:hover td { background: var(--primary-soft); }
.preview-table td { font-variant-numeric: tabular-nums; }

/* ==================== Result Summary ==================== */
.result-summary {
  margin: 14px 0;
  padding: 14px 16px;
  background: var(--primary-soft);
  border: 1px solid #a7f3d0;             /* emerald-200 */
  border-radius: var(--radius-lg);
  font-size: 14px;
  color: var(--primary-deep);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.result-summary::before {
  content: '✓';
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease);
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== Footer ==================== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ==================== Responsive ==================== */
@media (max-width: 720px) {
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 14px; }
  .panel { padding: 18px; }
  .header-inner { height: 56px; }
  .site-nav { display: none; }
  .panel-header { flex-direction: column; gap: 10px; }
  .mode-tab { padding: 8px 12px; font-size: 13px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 13px; }
  .feature-chips { gap: 6px; }
  .feature-chip { padding: 5px 10px; font-size: 12px; }
  .panel { padding: 14px; border-radius: var(--radius); }
  /* \u6a21\u5f0f tabs:\u8d85\u51fa\u53ef\u6a2a\u5411\u6eda\u52a8(\u4e0d\u6362\u884c,iOS \u98ce) */
  .mode-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px;
  }
  .mode-tabs::-webkit-scrollbar { display: none; }
  .mode-tab { padding: 7px 10px; font-size: 12px; flex-shrink: 0; }
  .mode-tab svg { width: 14px; height: 14px; }
  .meta-row { gap: 8px; }
  .options-row { padding: 12px; gap: 12px; }
  .file-list li { padding: 10px; font-size: 13px; }
  .file-list li::before { width: 28px; height: 28px; }
  .preview-table th, .preview-table td { padding: 8px 10px; font-size: 12px; max-width: 180px; }
}
