:root {
  --green: #2e8b57;
  --red: #c0392b;
  --bg: #f5f5f4;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #777;
  --border: #e2e2e0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --card: #262626;
    --text: #e5e5e5;
    --muted: #999;
    --border: #3a3a3a;
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1 { font-size: 1.3rem; color: var(--green); margin: 0; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0; }

/* --- login --- */

#login {
  max-width: 320px;
  margin: 20vh auto 0;
  padding: 0 1.5rem;
  text-align: center;
}

#login h1 { font-size: 1.8rem; margin-bottom: 1.5rem; }

#login form { display: flex; flex-direction: column; gap: 0.7rem; }

/* --- layout --- */

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
}

nav {
  display: flex;
  gap: 0.3rem;
  padding: 0.6rem 1rem;
  overflow-x: auto;
  position: sticky;
  top: 3.1rem;
  background: var(--bg);
  z-index: 9;
}

nav button {
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  color: var(--text);
}

nav button.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

nav .count {
  display: inline-block;
  margin-left: 0.35rem;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 0 0.42rem;
  font-size: 0.75rem;
}

#content, section > article, section > input, section > div {
  max-width: 640px;
}

#content { margin: 0 auto; padding: 0.5rem 1rem 4rem; }

/* --- cards --- */

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

.card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.card.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.meta { color: var(--muted); font-size: 0.85rem; }
.meta p { margin: 0.2rem 0 0; }

blockquote {
  margin: 0.6rem 0;
  padding: 0.5rem 0.8rem;
  border-left: 3px solid var(--green);
  background: var(--bg);
  border-radius: 0 8px 8px 0;
}
blockquote p { margin: 0.2rem 0 0; }

/* --- photos --- */

.photos { display: flex; gap: 0.6rem; margin: 0.6rem 0; }

.photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}

.photo img {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.photo.missing {
  width: 130px;
  height: 130px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  justify-content: center;
}

/* --- diff table --- */

table.diff {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

table.diff th, table.diff td {
  text-align: left;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.diff th { color: var(--muted); font-weight: 500; white-space: nowrap; }
table.diff td.before { color: var(--muted); text-decoration: line-through; }
table.diff td.after { color: var(--green); font-weight: 600; }

/* --- buttons & inputs --- */

button {
  font: inherit;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}

.actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }

button.approve { background: var(--green); color: #fff; }
button.reject { background: var(--red); color: #fff; }
button.neutral {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
button:disabled { opacity: 0.5; }

input {
  font: inherit;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  width: 100%;
}

#login button { background: var(--green); color: #fff; }

/* --- feedback --- */

details.card summary { cursor: pointer; }
.msg { margin: 0.4rem 0; font-size: 0.9rem; }
.msg.model { color: var(--muted); }

/* --- misc --- */

.badge.ok {
  margin-left: 0.4rem;
  font-size: 0.75rem;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 3rem 0;
}

#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(200%);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: transform 0.25s ease;
  max-width: 90vw;
  z-index: 100;
}

#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); color: #fff; }
