:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --error: #dc2626;
  --tag: #6366f1;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 2rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.tag { color: var(--muted); font-size: 0.85rem; }

main { max-width: 1200px; margin: 1.5rem auto; padding: 0 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

h1 { margin: 0 0 0.5rem; font-size: 1.4rem; }
h2 { margin: 0 0 1rem; font-size: 1.15rem; }
h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.muted { color: var(--muted); }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85rem; }
.small { font-size: 0.8rem; }

/* dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  cursor: pointer;
  margin: 1rem 0;
  background: #fafbfc;
  transition: background 0.15s, border-color 0.15s;
}
.dropzone:hover { background: #f0f4ff; border-color: var(--accent); }
.dropzone input { display: none; }
.dropzone-text { font-weight: 500; }

button, .btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
  font-weight: 500;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:hover:not(:disabled), .btn:hover { background: #f9fafb; }
.btn.primary, button[type=submit]:not(:disabled) {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn.primary:hover, button[type=submit]:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

#progress { margin-top: 1rem; }
.bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
#bar-fill { height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }
#progress-text { display: block; margin-top: 0.3rem; font-size: 0.85rem; color: var(--muted); }

.howto { margin-top: 1.5rem; color: var(--muted); }
.howto summary { cursor: pointer; font-weight: 500; color: var(--text); }
.howto ol { margin: 0.75rem 0 0 1rem; padding: 0; }
.howto li { margin-bottom: 0.3rem; }

/* report */
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: 0.5rem; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.stat {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.stat .num { display: block; font-size: 1.8rem; font-weight: 600; }
.stat .lbl { color: var(--muted); font-size: 0.8rem; }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }

.warnings { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 1rem; margin-top: 1rem; }
.warnings h3 { margin-bottom: 0.5rem; color: var(--warn); }
.warnings ul { margin: 0; padding-left: 1.2rem; }

/* table */
.result-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.result-table th, .result-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.result-table th { background: #fafbfc; font-weight: 600; }
.result-table tr.row-tag { background: #f5f3ff; }
.result-table tr.row-tag-uin-not-in-excel { background: #fef2f2; }
.result-table tr.row-no-tag-yet { background: #fffbeb; }
.thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 500; }
.badge.tag { background: #e0e7ff; color: #4338ca; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }

footer { text-align: center; color: var(--muted); padding: 2rem; font-size: 0.85rem; }
