:root {
  --bg: #f6f1ea;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #fffdf9;
  --line: #e7e0d5;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --ok: #166534;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background:
    radial-gradient(ellipse at top left, #fde68a55, transparent 45%),
    radial-gradient(ellipse at bottom right, #fdba7455, transparent 40%),
    var(--bg);
  color: var(--ink);
  padding: 18px 20px 28px;
}
h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
}
.sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
  line-height: 1.5;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.nav a {
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
}
.nav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}
label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}
textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
button {
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.danger { background: var(--danger); }
button:disabled { opacity: 0.55; cursor: wait; }
.result {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
}
.result .orig {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 6px;
}
.result .name {
  font-size: 1.05rem;
  font-weight: 700;
}
.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.chip {
  font-size: 0.75rem;
  background: var(--accent-soft);
  color: #92400e;
  padding: 3px 8px;
  border-radius: 999px;
}
.debug {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
}
.edit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 7px 6px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
.status {
  min-height: 1.2em;
  font-size: 0.82rem;
  margin-top: 8px;
  color: var(--ok);
}
.status.err { color: var(--danger); }
.hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.form-grid .full { grid-column: 1 / -1; }
.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.home-cards a {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.home-cards a strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
}
.home-cards a span {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
