:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #1f2421;
  --muted: #6b716d;
  --line: #e2e0da;
  --primary: #1f6f5c;
  --primary-ink: #ffffff;
  --danger: #b42318;
  --ok-bg: #e7f4ee;
  --error-bg: #fdecea;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif; }
a { color: var(--primary); }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 16px; }
[hidden] { display: none !important; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar nav > a { text-decoration: none; font-weight: 600; padding: 4px 0; border-bottom: 2px solid transparent; }
.topbar nav > a.active { border-bottom-color: var(--primary); }
.topbar form { margin: 0; }
.signout { display: flex; align-items: center; gap: 8px; }
.brand { font-weight: 800; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand span { font-weight: 500; color: var(--muted); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.login { max-width: 360px; margin: 48px auto; display: flex; flex-direction: column; gap: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.alert-ok { background: var(--ok-bg); }
.alert-error { background: var(--error-bg); color: var(--danger); }
.alert-info { background: #e8f0fe; color: #1d3f8a; }
.empty { color: var(--muted); }

.group { margin-bottom: 28px; }
.list { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list th, .list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.list tr:last-child td { border-bottom: 0; }
.list th:nth-child(1) { width: 40%; }
.list th:nth-child(2) { width: 15%; }
.list th:nth-child(3) { width: 25%; }
.list th:nth-child(4) { width: 12%; }
.list .title { font-weight: 600; }
.list .zh, .list .missing { display: block; font-size: 13px; color: var(--muted); }
.list .missing { font-style: italic; }
.muted { color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); }
.badge-draft { background: #fff4e5; border-color: #f5c48a; }
.badge-published { background: var(--ok-bg); border-color: #a7d7c1; color: #14513f; }
.badge-changed { background: #e8f0fe; border-color: #a8c1f0; color: #1d3f8a; }
.badge-featured { background: #fdf6e3; border-color: #e7d39a; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; min-width: 0; }
.field > span { font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); font-size: 12px; }
.lang { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
input[type=text], input[type=password], input[type=number], select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
textarea { resize: vertical; }
.field-error { color: var(--danger); font-size: 13px; margin: 0; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; align-items: start; }
.grid .check { margin-bottom: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 4px; }
.check small { display: block; color: var(--muted); font-size: 12px; }

.image-field { display: flex; flex-direction: column; gap: 8px; }
.image-field .preview { max-width: 320px; max-height: 200px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.image-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status { font-size: 13px; color: var(--muted); }

.rep-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.rep-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.rep-fields { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; align-items: start; min-width: 0; }
.rep-row .preview { max-width: 160px; max-height: 120px; }
.rep-row .image-field { margin-bottom: 14px; }

.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.secondary-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.secondary-actions form { margin: 0; }
.small { font-size: 13px; }
.intro { color: var(--muted); max-width: 640px; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plain li { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; justify-content: space-between; gap: 12px; }
.single { display: block; }
.field .label { font-weight: 600; font-size: 14px; }
.counter { display: block; color: var(--muted); font-size: 12px; }
.counter-high { color: var(--danger); }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 32px; }

.activity { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.activity li { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; overflow-wrap: anywhere; }
.activity details { margin-top: 6px; }
.activity summary { cursor: pointer; color: var(--primary); font-size: 13px; }
.changes { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; table-layout: fixed; }
.changes th { text-align: left; width: 22%; font-weight: 600; padding: 4px 8px 4px 0; vertical-align: top; }
.changes td { padding: 4px 8px; vertical-align: top; white-space: pre-wrap; }
.changes .before { background: #fdecea; text-decoration: line-through; color: #7a271a; }
.changes .after { background: var(--ok-bg); }

@media (max-width: 760px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 12px 16px; }
  .pair, .grid { grid-template-columns: 1fr; }
  .rep-row { flex-direction: column; }
  .rep-fields { width: 100%; }
  .list th:nth-child(2), .list td:nth-child(2) { display: none; }
  .list th:nth-child(4), .list td:nth-child(4) { display: none; }
  .list th:nth-child(1) { width: 50%; }
}
.card > .check { margin-bottom: 14px; }
