:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1f2329;
  --muted: #8a919f;
  --line: #e5e7eb;
  --primary: #2f6bff;
  --primary-d: #1f56db;
  --ok: #16a34a;
  --ok-bg: #e8f7ee;
  --warn: #c2410c;
  --warn-bg: #fff1e6;
  --open: #b45309;
  --open-bg: #fef3c7;
  --err: #dc2626;
  --err-bg: #fdecec;
  --info: #2563eb;
  --info-bg: #e8f0ff;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 8px 0 16px; line-height: 1.35; word-break: break-word; }
h2.sec { font-size: 16px; margin: 28px 0 12px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 60px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }
.req { color: var(--err); }
[hidden] { display: none !important; }

/* 顶栏 */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 6px 12px; border-radius: 6px; color: var(--text); }
.nav a:hover { background: var(--bg); text-decoration: none; }
.me { display: flex; align-items: center; gap: 12px; font-size: 14px; white-space: nowrap; }
.me a { color: var(--text); }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: var(--err); }
form.inline { display: inline; margin: 0; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c9ced6; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* 卡片和表单 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.form label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
.form label:first-child, .form .alert + label { margin-top: 0; }
input:not([type=file]):not([type=hidden]), textarea, select {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
textarea { resize: vertical; min-height: 96px; }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 .full { grid-column: 1 / -1; }
.grid2 label { margin-top: 14px; }
.actions-bottom { display: flex; align-items: flex-end; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert.err { background: var(--err-bg); color: var(--err); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.narrow { max-width: 440px; }

/* 登录 */
.login { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login h1 { font-size: 26px; margin-bottom: 4px; }
.login .card { text-align: left; margin-top: 20px; }
.login .btn { margin-top: 20px; height: 42px; }

/* 页头、标签页 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 8px 0; }
.crumb { font-size: 14px; margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; margin: 12px 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs b { font-weight: 500; font-size: 13px; }
.filter select { width: auto; min-width: 180px; }

/* 列表 */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); }
.item:hover { border-color: #b9c6e8; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.item-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-main .title { font-weight: 600; font-size: 15px; word-break: break-word; }
.item-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.no { color: var(--muted); font-weight: 500; }
.empty { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 48px 16px; text-align: center; color: var(--muted); }

/* 状态标签 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.open { background: var(--open-bg); color: var(--open); }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.gray { background: #f0f1f3; color: var(--muted); }
.badge.big { font-size: 14px; padding: 4px 14px; }
.tag { display: inline-block; padding: 0 8px; border-radius: 4px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.proj { background: #f0f1f3; color: #4b5563; }

/* 需求详情 */
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.ticket-head h1 { margin-bottom: 6px; }
.th-main { min-width: 0; }
.th-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; align-items: center; }
.post { margin-bottom: 12px; }
.post-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 14px; }
.content { white-space: pre-wrap; word-break: break-word; }
.reply.from-admin { border-left: 3px solid var(--primary); }
.reply-form { margin-top: 20px; }

/* 附件 */
.atts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.att-img { display: block; width: 160px; height: 120px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fafafa; }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-video { width: 100%; max-width: 560px; }
.att-video video { width: 100%; max-height: 420px; border-radius: 8px; background: #000; display: block; }
.att-name { font-size: 12px; color: var(--muted); margin-top: 4px; word-break: break-all; }

/* 上传 */
.dropzone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px; border: 1px dashed #c9ced6; border-radius: 8px; }
.upload-form.drag .dropzone { border-color: var(--primary); background: var(--info-bg); }
.file-btn input { display: none; }
.picked { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pick { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pick img, .pick .vid { width: 48px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.pick .vid { display: inline-flex; align-items: center; justify-content: center; background: #1f2329; color: #fff; font-size: 11px; }
.pick .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .rm { background: none; border: 0; color: var(--err); cursor: pointer; font: inherit; font-size: 13px; }
.form-error { margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: var(--err-bg); color: var(--err); font-size: 14px; }
.progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.progress .bar { flex: 1; height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.progress em { font-style: normal; font-size: 13px; color: var(--muted); min-width: 120px; text-align: right; }

/* 表格 */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table th { background: #fafbfc; color: var(--muted); font-weight: 500; }
.table tr:last-child td { border-bottom: 0; }
.table tr.off td { color: var(--muted); }
.ops { display: flex; gap: 8px; align-items: center; }
.reset-form { display: inline-flex; gap: 6px; align-items: center; }
.reset-form input { width: 130px; height: 30px; padding: 4px 8px; font-size: 13px; }
.errbox { max-width: 520px; margin: 10vh auto 0; text-align: center; }

@media (max-width: 640px) {
  .topbar-in { gap: 10px; }
  .brand { font-size: 15px; }
  .nav a { padding: 6px 8px; font-size: 14px; }
  .me > a { display: none; }
  h1 { font-size: 19px; }
  .card { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .actions-bottom { margin-top: 8px; }
  .ticket-head { flex-direction: column; }
  .th-side { flex-direction: row; align-items: center; }
  .att-img { width: calc(50% - 5px); height: 110px; }
  .filter select { min-width: 140px; }
}
