/* CM-Annotator 雙語介面樣式 */
:root {
  --bg: #f6f4ef; --panel: #fffdf8; --ink: #2b2a26; --muted: #8a8577;
  --accent: #7a5c2e; --accent2: #3d6b64; --line: #e3ded2;
  --p-preserve: #3e7d46; --p-replace: #c47f17; --p-literalize: #3d6b9e;
  --p-add: #7a4f9e; --p-delete: #b34a3c; --p-none: #8a8577;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, Menlo, monospace; }

/* 頂欄 */
#topbar { display: flex; align-items: center; gap: 24px; padding: 10px 20px;
  background: linear-gradient(180deg, #2f2b22, #3a352a); color: #f2ead9; }
#brand { display: flex; gap: 12px; align-items: center; }
#brand h1 { font-size: 17px; margin: 0; font-weight: 600; }
#brand .subtitle { font-size: 11px; opacity: .75; }
.logo { display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px; background: #c9a24b; color: #241f14;
  font-weight: 800; font-size: 15px; letter-spacing: 1px; }
#tabs { display: flex; gap: 4px; margin-left: auto; }
.tab { background: transparent; color: #d8cfba; border: 1px solid transparent;
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.tab:hover { color: #fff; background: rgba(255,255,255,.07); }
.tab.active { background: #c9a24b; color: #241f14; font-weight: 600; }
#langToggle { display: flex; gap: 2px; }
#langToggle button { background: rgba(255,255,255,.1); color: #e8dfc8; border: none;
  padding: 6px 10px; cursor: pointer; border-radius: 5px; font-size: 12px; }
#langToggle button.active { background: #f2ead9; color: #2f2b22; font-weight: 700; }

main { padding: 18px 20px; max-width: 1400px; margin: 0 auto; }
.view { min-height: 60vh; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
input, select { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; font-size: 13px; min-width: 90px; }
button { padding: 7px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 7px; cursor: pointer; font-size: 13px; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent2); color: #fff; border-color: var(--accent2); }
button.mini { padding: 2px 8px; font-size: 11px; }

/* 瀏覽 */
#view-browse { display: flex; gap: 16px; }
#domainList { width: 190px; flex-shrink: 0; }
#domainList ul { list-style: none; padding: 0; margin: 0; }
#domainList li { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; margin-bottom: 2px; }
#domainList li:hover { background: #efe9db; }
#domainList li.active { background: var(--accent); color: #fff; }
#browseMain { flex: 1; min-width: 0; }
table.grid { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 13px; }
table.grid th { text-align: left; background: #efe9db; padding: 8px 10px; font-size: 12px;
  color: #6b6350; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid #f0ece1; vertical-align: top; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: #faf6ec; }
#pager { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
#pageInfo { font-size: 13px; color: var(--muted); }

/* span 標示 */
mark.cm { border-radius: 4px; padding: 0 3px; background: hsl(var(--h, 40), 55%, 82%);
  border-bottom: 2px solid hsl(var(--h, 40), 45%, 45%); cursor: default; }
.relBadge { display: inline-block; padding: 2px 9px; border-radius: 10px; color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .4px; }
.rel-PRESERVE { background: var(--p-preserve); } .rel-REPLACE { background: var(--p-replace); }
.rel-LITERALIZE { background: var(--p-literalize); } .rel-ADD { background: var(--p-add); }
.rel-DELETE { background: var(--p-delete); } .rel-NONE { background: var(--p-none); }

#pairDetail { margin-top: 14px; }
.sentBlock { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; }
.sentBlock .langTag { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.sentText { font-size: 15px; line-height: 1.7; margin: 4px 0; }
.spanCards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.spanCard { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px;
  background: #faf6ec; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; }
.spanCard .t { font-weight: 700; }
.spanCard .meta { color: var(--muted); }
.linkRow { font-size: 12px; margin: 3px 0; color: var(--muted); }
.linkRow b { color: var(--ink); }

/* 統計 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; }
.card .num { font-size: 24px; font-weight: 700; color: var(--accent2); }
.card .lbl { font-size: 12px; color: var(--muted); }
.statsRow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bar { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 12.5px; }
.bar .name { width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { flex: 1; height: 14px; background: #efe9db; border-radius: 7px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent2); border-radius: 7px; }
.bar .val { width: 50px; text-align: right; color: var(--muted); }
table.xtab { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.xtab th, table.xtab td { border: 1px solid var(--line); padding: 6px 8px; text-align: right; }
table.xtab th:first-child, table.xtab td:first-child { text-align: left; }

#searchCount { margin: 8px 0; }
footer { text-align: center; padding: 20px; }
