:root {
  --color-primary: #059669;
  --color-on-primary: #ffffff;
  --color-secondary: #10b981;
  --color-accent: #d97706;
  --color-background: #ecfdf5;
  --color-foreground: #0f172a;
  --color-muted: #f0f8f6;
  --color-border: #e1f2ed;
  --color-card: #ffffff;
  --color-destructive: #dc2626;
  --color-text-muted: #64748b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-background);
  color: var(--color-foreground);
  -webkit-font-smoothing: antialiased;
}

body { padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }

.hidden { display: none !important; }

.view { min-height: 100vh; }

/* Login */
.login-hero {
  padding: 48px 24px 32px;
  text-align: center;
}

.logo-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-mark svg { width: 28px; height: 28px; }

.login-hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-hero p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  margin: 0 20px;
  padding: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.field input,
.field select {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fff;
  color: var(--color-foreground);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); opacity: 0.92; }

.btn-primary {
  width: 100%;
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.btn-outline {
  width: calc(100% - 32px);
  margin: 8px 16px 24px;
  background: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-ghost {
  background: var(--color-muted);
  color: var(--color-foreground);
}

.error-text {
  color: var(--color-destructive);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-bar-main { flex: 1; min-width: 0; }

.top-bar h1 {
  font-size: 1.1rem;
  font-weight: 700;
}

.sub-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--color-muted);
  border-radius: var(--radius-sm);
  color: var(--color-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn svg { width: 20px; height: 20px; }

/* Platform / verdict tabs */
.platform-tabs,
.verdict-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.verdict-tabs {
  padding-top: 0;
}

.tab {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 500;
}

.stats-bar {
  padding: 0 16px 8px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Lead cards */
.lead-list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.lead-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.verdict-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.verdict-badge.valid { background: #dcfce7; color: #15803d; }
.verdict-badge.invalid { background: #f1f5f9; color: #64748b; }
.verdict-badge.duplicate { background: #ffedd5; color: #c2410c; }

.verdict-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.decision-reason { line-height: 1.4; }

.matched-term {
  color: var(--color-accent);
  font-weight: 500;
}

.lead-task {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.platform-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-muted);
  color: var(--color-text-muted);
}

.platform-badge.xhs { background: #fef2f2; color: #dc2626; }
.platform-badge.douyin { background: #f5f3ff; color: #7c3aed; }

.lead-nickname {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.lead-content {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-foreground);
  margin-bottom: 8px;
  word-break: break-word;
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.lead-meta a {
  color: var(--color-primary);
  text-decoration: none;
}

.empty-state,
.loading-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-foreground);
  margin-bottom: 4px;
}

.empty-state span { font-size: 0.85rem; }

/* Filter sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  max-height: 85vh;
  overflow: auto;
  padding-bottom: var(--safe-bottom);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  border-bottom: 1px solid var(--color-border);
}

.sheet-header h2 { font-size: 1rem; }

.sheet-body { padding: 16px; }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.sheet-actions .btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .btn, .sheet-panel { transition: none; animation: none; }
}
