/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #7C6EEE;
  --purple-light: #EDE9FF;
  --purple-dark: #5B50C8;
  --text: #1e1e2e;
  --text-sub: #6b7280;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,.07);
}

body {
  font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== Topbar ===== */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.topbar-about {
  font-size: 13px;
  color: var(--purple);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--purple);
  border-radius: 20px;
  transition: background .15s;
}
.topbar-about:hover { background: var(--purple-light); }

/* ===== Main layout ===== */
.main-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  margin-bottom: 32px;
}
.hero-icon { margin-bottom: 14px; }
.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.hero p {
  margin-top: 8px;
  color: var(--text-sub);
  font-size: 15px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Upload card ===== */
.upload-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
  border: 1px solid var(--border);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #c4b8ff;
  border-radius: var(--radius);
  background: #fafafe;
  padding: 40px 20px 36px;
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  background: var(--purple-light);
  border-color: var(--purple);
}
.drop-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: block;
}
.drop-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.drop-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--purple);
}
#file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* Form */
.form-row { margin-top: 18px; }
.sheet-picked {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f9fafb;
  padding: 12px 14px;
}
.sheet-picked-title { font-size: 14px; font-weight: 700; color: var(--text); }
.sheet-picked-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
  outline: none;
}
.form-input:focus { border-color: var(--purple); }

.options-row { margin-top: 14px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
}
.check-item input[type=checkbox] { display: none; }
.check-box {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.check-item input[type=checkbox]:checked + .check-box {
  background: var(--purple);
  border-color: var(--purple);
}
.check-item input[type=checkbox]:checked + .check-box::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--purple-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 18px;
  background: #16a34a;
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
}
.btn-download:hover { background: #15803d; }

/* ===== Alerts ===== */
.alerts { margin-top: 16px; display: grid; gap: 10px; }
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ===== Result card ===== */
.result-card {
  margin-top: 16px;
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.result-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 14px;
}
.result-list {
  list-style: none;
  display: grid;
  gap: 8px;
}
.result-list li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 8px 12px;
  background: #fafafa;
  border-radius: 8px;
}
.result-list span { color: var(--text-sub); }
.result-list strong { font-weight: 600; }

/* ===== Login page ===== */
.login-page { background: var(--bg); }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 16px; }
.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 24px;
}
.login-form .form-label { margin-top: 0; }
.back-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-sub);
  text-decoration: none;
}
.back-link:hover { color: var(--purple); }

/* ===== Spinner ===== */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; }

/* ===== About page ===== */
.about-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 { margin-bottom: 10px; color: var(--text); }
.markdown-body p { margin-bottom: 10px; color: var(--text); }
.markdown-body ul,
.markdown-body ol { margin-left: 18px; margin-bottom: 10px; }
.markdown-body code {
  background: #f3f4f6;
  border-radius: 6px;
  padding: 2px 6px;
  font-family: Consolas, monospace;
  font-size: 13px;
}
.markdown-body pre {
  background: #111827;
  color: #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  margin-bottom: 12px;
}

