/* Yes老師 審稿後台 — warm paper ground, the teacher's red square as the only loud colour */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1c2526;
  --ink-2: #44504d;
  --muted: #727d7a;
  --line: #e2ded4;
  --line-2: #eeebe4;
  --red: #d23b2a;
  --red-ink: #ad2e1f;
  --teal: #1d7484;
  --teal-ink: #165c69;
  --teal-soft: #e2f0f2;
  --ok: #237a45;
  --ok-soft: #e2f3e7;
  --warn: #9a6300;
  --warn-soft: #fbefd6;
  --gray-soft: #eeeeeb;
  --pending: #4f5f80;
  --pending-soft: #e8ecf5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 37, 38, .06), 0 6px 18px rgba(28, 37, 38, .05);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.7; }
img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5rem; text-wrap: balance; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: .92em; background: var(--line-2); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 18px; }
.main { padding-top: 22px; padding-bottom: 64px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.center { text-align: center; }
.top-gap { margin-top: 14px; }
.eyebrow { font-size: .78rem; letter-spacing: .14em; color: var(--muted); margin: 0 0 .2rem; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* brand + header */
.sq { display: inline-block; width: 12px; height: 12px; background: var(--red); flex: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { font-size: 1.05rem; }
.brand span { color: var(--muted); font-size: .85rem; }
.brand.big { font-size: 1.3rem; margin-bottom: .6rem; }
.brand.big .sq { width: 16px; height: 16px; }
.brand.big b { font-size: 1.5rem; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-inner { display: flex; align-items: center; gap: 18px; min-height: 56px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav a { color: var(--ink-2); padding: 16px 10px 14px; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .94rem; }
.nav a:hover { text-decoration: none; color: var(--ink); }
.nav a.on { color: var(--ink); border-bottom-color: var(--red); font-weight: 500; }
.me { position: relative; }
.me summary { list-style: none; cursor: pointer; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; white-space: nowrap; }
.me summary::-webkit-details-marker { display: none; }
.me-menu { position: absolute; right: 0; top: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; display: grid; gap: 4px; min-width: 140px; }
.me-menu a, .me-menu button { padding: 6px 8px; text-align: left; font-size: .9rem; }

/* buttons + forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: .92rem; padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { border-color: #c9c4b8; text-decoration: none; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: var(--warn-soft); border-color: #e9cf95; color: var(--warn); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: .85rem; }
.btn.tiny { padding: 3px 9px; font-size: .8rem; border-radius: 6px; }
.btn.block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.danger { color: var(--red-ink) !important; }
form.inline, .inline { display: inline; }
.stack { display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-size: .9rem; color: var(--ink-2); }
label.check { display: flex; align-items: center; gap: 8px; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; line-height: 1.6; }
input[type=checkbox] { width: auto; }
input[type=file] { padding: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.narrow-form { max-width: 460px; }

/* surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.panel > summary, details.panel > summary { cursor: pointer; font-weight: 500; }
.narrow { max-width: 520px; margin: 30px auto; }
.note { background: var(--teal-soft); color: var(--teal-ink); padding: 8px 12px; border-radius: 8px; }
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe3ca; padding: 9px 14px; border-radius: 8px; font-size: .92rem; }
.flash.error { background: #fdecea; color: var(--red-ink); border-color: #f4c7c0; }
.page-head { margin-bottom: 16px; }
.page-head .muted { max-width: 46rem; }

/* status chips + tags */
.chip { display: inline-block; font-size: .78rem; font-weight: 500; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st-pending { background: var(--pending-soft); color: var(--pending); }
.st-selected { background: var(--ok-soft); color: var(--ok); }
.st-revise { background: var(--warn-soft); color: var(--warn); }
.st-rejected { background: var(--gray-soft); color: #7d817f; text-decoration: line-through; }
.st-posted { background: var(--teal-soft); color: var(--teal-ink); }
.tag { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag.hi { background: var(--warn-soft); color: var(--warn); }
.role { display: inline-block; font-size: .72rem; padding: 0 7px; border-radius: 5px; margin-right: 6px; border: 1px solid var(--line); color: var(--ink-2); }
.role-client { background: #fdecea; border-color: #f4c7c0; color: var(--red-ink); }
.role-admin { background: var(--teal-soft); border-color: #bfdde2; color: var(--teal-ink); }
.role-ai { background: #efeaf8; border-color: #d9cff0; color: #5b4a8a; }

/* login */
.page-login { background: var(--bg); }
.login-card { max-width: 400px; margin: 9vh auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px; box-shadow: var(--shadow); }

/* week page */
.week-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.week-head .muted { max-width: 40rem; }
.meter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; min-width: 220px; }
.meter-num b { font-size: 2rem; line-height: 1; margin-right: 6px; }
.meter-num span { color: var(--muted); font-size: .9rem; }
.meter-dots { display: flex; gap: 6px; margin-top: 8px; }
.meter-dots i { width: 28px; height: 8px; border-radius: 4px; background: var(--line); }
.meter-dots i.on { background: var(--ok); }
.week-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.week-pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.week-pick { position: relative; }
.week-pick summary { list-style: none; }
.week-pick summary::-webkit-details-marker { display: none; }
.week-pick ul { position: absolute; z-index: 10; top: 38px; left: 0; list-style: none; margin: 0; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 260px; max-height: 320px; overflow: auto; }
.week-pick li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 6px; }
.week-pick a.on { font-weight: 700; color: var(--ink); }
.batch-note .prewrap { margin-top: 10px; color: var(--ink-2); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.tabs a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .88rem; white-space: nowrap; }
.tabs a span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a.on span { color: #cfd6d4; }
.tabs a:hover { text-decoration: none; }
.week-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.acard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.acard-img { display: block; aspect-ratio: 4 / 3; background: var(--line-2); overflow: hidden; }
.acard-img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .85rem; }
.acard-body { padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.acard-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.acard h2 { font-size: 1rem; margin: 4px 0 2px; }
.acard h2 a { color: var(--ink); }
.acard .slot { color: var(--teal-ink); margin: 0; }
.acard-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line-2); }
.acard-actions { display: flex; gap: 6px; }
.activity { position: sticky; top: 74px; }
.activity ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .88rem; }

/* article page */
.crumbs { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.crumbs .pager { margin-left: auto; display: flex; gap: 6px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.fbpost { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.fb-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.fb-av { width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.fb-who { display: grid; line-height: 1.35; flex: 1; }
.fb-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 18px 16px; font-size: 1rem; line-height: 1.75; }
.fb-imgs { display: grid; gap: 2px; position: relative; background: var(--line-2); }
.fb-imgs img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; }
.fb-imgs.n1 img { aspect-ratio: auto; max-height: 640px; object-fit: contain; background: #fff; }
.fb-imgs.n2 { grid-template-columns: 1fr 1fr; }
.fb-imgs.n3 { grid-template-columns: 1fr 1fr; }
.fb-imgs.n3 a:first-child { grid-column: 1 / -1; }
.fb-imgs.n3 a:first-child img { aspect-ratio: 16 / 10; }
.fb-imgs.n4 { grid-template-columns: 1fr 1fr; }
.fb-more { position: absolute; right: 12px; bottom: 12px; background: rgba(0, 0, 0, .62); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: .9rem; }
.fb-foot { padding: 10px 18px; border-top: 1px solid var(--line-2); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 10px 0 14px; }
.img-item { margin: 0; border: 2px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--line-2); }
.img-item.chosen { border-color: var(--ok); }
.img-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #fff; }
.img-item figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px; background: var(--surface); font-size: .8rem; }
.kind { font-size: .74rem; padding: 0 6px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); }
.kind-card { background: #fdecea; color: var(--red-ink); }
.kind-source { background: var(--teal-soft); color: var(--teal-ink); }
.kind-ai { background: #efeaf8; color: #5b4a8a; }
.sub-box { border-top: 1px solid var(--line-2); padding-top: 12px; margin-top: 12px; }
.sub-box > summary { cursor: pointer; color: var(--teal); font-size: .92rem; margin-bottom: 10px; }
.diff { font-size: .92rem; line-height: 1.7; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.diff div { padding: 1px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.d-add { background: #e6f5ea; }
.d-add::before { content: "＋ "; color: var(--ok); }
.d-del { background: #fdecea; color: #8d3a30; text-decoration: line-through; }
.d-del::before { content: "－ "; }
.d-gap { color: var(--muted); font-size: .82rem; background: var(--line-2); }
.thread { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.c { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.c-system { background: #faf9f6; }
.c-decision { border-left: 3px solid var(--teal); }
.c-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.c-head b { font-size: .9rem; }
.done { color: var(--ok); }
.decide { position: sticky; top: 74px; }
.decide-status { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .9rem; color: var(--ink-2); }
.decide-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.decide-btns .btn { padding: 9px 6px; }
.admin-links { display: flex; gap: 14px; align-items: center; margin-top: 12px; font-size: .9rem; }
.flags { background: #fffaf0; border-color: #efd9a7; }
.flags ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.flags li { margin-bottom: 6px; }
.src-card + .src-card { border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 10px; }
.stats { display: flex; gap: 14px; margin: 6px 0; font-size: .85rem; color: var(--ink-2); }
.stats b { font-size: 1.05rem; color: var(--ink); margin-right: 3px; }
.orig { max-height: 360px; overflow: auto; background: var(--bg); padding: 10px; border-radius: 8px; margin-top: 8px; }
.versions { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

/* guidelines */
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.rules li { border: 1px solid var(--line-2); border-left: 3px solid var(--red); border-radius: 8px; padding: 10px 12px; }
.inline-edit { display: inline-block; margin-right: 10px; }
.inline-edit summary { cursor: pointer; color: var(--teal); list-style: none; }

/* library */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input { flex: 2 1 220px; }
.filters select { flex: 1 1 140px; width: auto; }
.lib-list { display: grid; gap: 10px; }
.lib-item { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.lib-thumb { width: 92px; height: 92px; border-radius: 8px; overflow: hidden; background: var(--line-2); }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-text { color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.req-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.req-list li { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; }
.pagination { display: flex; justify-content: center; gap: 12px; align-items: center; margin-top: 16px; }

/* admin tables + one-time secrets */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: .82rem; }
.table tr.muted td { color: var(--muted); }
.table .actions { white-space: nowrap; display: flex; gap: 12px; }
.secret { border-color: #efd9a7; background: #fffaf0; }
.big-code { font-size: 1.1rem; padding: .2em .5em; background: #fff; border: 1px dashed #d9b968; }
.wrap-any { overflow-wrap: anywhere; word-break: break-all; display: inline-block; max-width: 100%; }

@media (max-width: 980px) {
  .week-layout, .article-layout { grid-template-columns: 1fr; }
  .activity, .decide { position: static; }
  .col-side { order: 0; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 0 12px; }
  .top-inner { gap: 10px; flex-wrap: wrap; padding-top: 6px; }
  .brand span { display: none; }
  .nav { order: 3; flex-basis: 100%; }
  .nav a { padding: 8px 10px 10px; }
  .me { margin-left: auto; }
  h1 { font-size: 1.3rem; }
  .row2 { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .fb-text { padding: 6px 14px 14px; }
  .decide-btns { grid-template-columns: 1fr; }
  .meter { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
