:root {
  --ink: #333333;
  --ink-soft: #666666;
  --muted: #999999;
  --line: #eeeeee;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --page: #f7f8fa;
  /* bright coral red — match screenshot (小红书风) */
  --accent: #ff2442;
  --accent-hover: #ef1f3c;
  --accent-deep: #ff2442;
  --accent-soft: rgba(255, 36, 66, 0.1);
  --accent-softer: #fff1f2;
  --warn: #e6a23c;
  --danger: #ff2442;
  --ok: #67c23a;
  --ok-soft: #f0f9eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
  --radius: 12px;
  --font-display: "Noto Sans SC", "Source Sans 3", sans-serif;
  --font-body: "Noto Sans SC", "Source Sans 3", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--page);
}

a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 36px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  color: var(--accent);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--page);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.content {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.content-wide {
  width: min(1100px, calc(100% - 32px));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 28px);
  margin-bottom: 16px;
  animation: rise 0.4s ease both;
}

.panel + .panel { animation-delay: 0.06s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
}

h1 { font-size: clamp(1.55rem, 3.5vw, 1.9rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.05rem; }

.lead, .muted {
  color: var(--muted);
  line-height: 1.65;
}

.lead { margin: 0 0 18px; font-size: 0.95rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  text-decoration: none !important;
}

.btn-primary {
  background: var(--accent);
  color: #fff !important;
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: #fff;
  border-color: #d9d9d9;
  color: var(--ink) !important;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
  background: var(--accent-softer);
}

.btn-block { width: 100%; }

.field { margin-top: 16px; }

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.field select,
.field input[type="file"] {
  width: 100%;
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 11px 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select:focus,
.field input[type="file"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice {
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.choice strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.choice small {
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.82rem;
}

.choice input:checked + span {
  border-color: var(--accent);
  background: var(--accent-softer);
  box-shadow: none;
}

.choice:hover span {
  border-color: #ffb3bd;
}

.dropzone {
  position: relative;
  border: 1.5px dashed #ffc2ca;
  border-radius: 12px;
  background: var(--accent-softer);
  padding: 28px 18px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #ffe8eb;
}

.dropzone.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f7f8fa;
  border-color: var(--line);
}

.dropzone.disabled input[type="file"] {
  pointer-events: none;
  cursor: not-allowed;
}

.progress-panel {
  margin-top: 20px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffafa;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.progress-head strong { color: var(--ink); }
#progress-pct {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #f0f1f3;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff6b7a, var(--accent));
  transition: width 0.25s ease;
}

.progress-files {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-files li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.progress-files .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.progress-files .meta {
  flex-shrink: 0;
  color: var(--muted);
}

.progress-files li.is-ok .meta { color: var(--ok); }
.progress-files li.is-error .meta { color: var(--danger); }

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dropzone-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--ink);
}

.dropzone-file {
  margin-top: 10px;
  color: var(--accent-deep);
  font-weight: 600;
  word-break: break-all;
}

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.flash.ok {
  background: var(--ok-soft);
  border: 1px solid #c8e6c9;
  color: var(--ok);
}

.flash.err {
  background: var(--accent-softer);
  border: 1px solid #ffc2ca;
  color: var(--danger);
}

.feature-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none !important;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.feature-link:hover {
  border-color: #ffb3bd;
  background: var(--accent-softer);
  box-shadow: none;
}

.feature-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-link h3 { margin-bottom: 4px; }
.feature-arrow {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
  font-size: 1rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-imported, .status-stored {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-error {
  background: var(--accent-softer);
  color: var(--danger);
}

.status-queued, .status-importing {
  background: #fff7e8;
  color: var(--warn);
}

.sub { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft) !important;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
}

.tab:hover {
  border-color: #ffb3bd;
  color: var(--accent) !important;
}

.tab.active {
  background: var(--accent-softer);
  border-color: var(--accent);
  color: var(--accent) !important;
}

.tab-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.tab.active .tab-count {
  background: #fff;
  color: var(--accent);
}

.table-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.data-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 8px;
}

.data-grid table {
  font-size: 0.82rem;
}

.data-grid th,
.data-grid td {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-grid th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.data-grid.table-wrap {
  max-height: min(70vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pager-jump input[type="number"] {
  width: 72px;
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

#kst-kind-wrap { display: none; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--page);
}

.login-card {
  width: min(420px, 100%);
  padding: clamp(28px, 5vw, 36px);
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.login-mark {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.login-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.hint code {
  font-size: 0.78rem;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 4px;
}

.seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: #f3f4f6;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.seg-item {
  position: relative;
  cursor: pointer;
}

.seg-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-item span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
}

.seg-item input:checked + span {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

textarea {
  width: 100%;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 560px) {
  .choice-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
}
