:root {
  --bg: #f6f7f9; --card: #fff; --line: #e3e6ea; --text: #1f2328; --muted: #6b7280;
  --accent: #2563eb; --accent-bg: #eaf1ff; --danger: #dc2626; --ok: #16a34a; --warn: #d97706;
  --p0: #dc2626; --p1: #ea580c; --p2: #2563eb; --p3: #6b7280;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
#topbar { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 48px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
#topbar .brand { font-weight: 600; color: var(--text); font-size: 15px; }
#nav a { margin-right: 14px; color: var(--muted); }
#nav a.on { color: var(--accent); font-weight: 600; }
#whoami { margin-left: auto; color: var(--muted); }
#whoami button { margin-left: 8px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, .btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; color: var(--text); }
button:hover { border-color: #b9c0c9; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); border-color: #f3b4b4; }
button.ok { color: var(--ok); border-color: #b7e4c7; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); width: 100%; }
textarea { min-height: 90px; resize: vertical; }
textarea.body { min-height: 160px; font-family: inherit; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfc; font-weight: 600; color: var(--muted); font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; line-height: 18px; background: #eef0f3; color: var(--muted); white-space: nowrap; }
.prio { font-weight: 700; color: #fff; }
.prio.p0 { background: var(--p0); } .prio.p1 { background: var(--p1); } .prio.p2 { background: var(--p2); } .prio.p3 { background: var(--p3); }
.st { font-weight: 600; }
.st.open { background: #eef0f3; color: #374151; }
.st.in_progress { background: #fef3c7; color: #92400e; }
.st.fixed { background: #dcfce7; color: #166534; }
.st.closed { background: #e5e7eb; color: #6b7280; }
.st.need_info { background: #fee2e2; color: #991b1b; }
.st.needs_decision { background: #ede9fe; color: #5b21b6; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stats .box { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; min-width: 90px; cursor: pointer; }
.stats .box b { display: block; font-size: 18px; }
.stats .box.on { border-color: var(--accent); background: var(--accent-bg); }
.md { white-space: normal; word-break: break-word; }
.md img { max-width: 100%; max-height: 480px; border: 1px solid var(--line); border-radius: 6px; display: block; margin: 6px 0; cursor: zoom-in; }
.md pre { background: #f3f4f6; padding: 10px; border-radius: 6px; overflow-x: auto; }
.md code { background: #f3f4f6; padding: 1px 4px; border-radius: 4px; }
.md p { margin: 0 0 8px; }
.field { margin-bottom: 10px; }
.field .k { font-size: 12px; color: var(--muted); }
.fixnote { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 14px; }
.comment { border-top: 1px solid var(--line); padding: 10px 0; }
.comment.agent { background: #fffbeb; margin: 0 -18px; padding: 10px 18px; border-top: 1px solid #fde68a; }
.comment .who { font-weight: 600; margin-right: 8px; }
.attach { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attach a.file { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: #fafbfc; }
.attach img { height: 90px; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; }
.dropzone { border: 2px dashed var(--line); border-radius: 8px; padding: 6px; transition: border-color .15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-bg); }
.dropzone .hint { font-size: 12px; color: var(--muted); padding: 4px 6px; display: flex; gap: 10px; align-items: center; }
.dropzone textarea { border: 0; padding: 8px 6px; }
.timeline { font-size: 12px; color: var(--muted); }
.timeline div { padding: 2px 0; }
.err { color: var(--danger); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 8px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; }
#toast.show { opacity: 1; }
.login { max-width: 360px; margin: 80px auto; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details pre { max-height: 300px; overflow: auto; font-size: 12px; background: #f3f4f6; padding: 8px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 20; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 96vh; }
.token { font-family: ui-monospace, Menlo, monospace; background: #fef3c7; padding: 6px 10px; border-radius: 6px; word-break: break-all; }
