:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #e3e8ef;
  --text: #1a2230;
  --muted: #6b7688;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", "PingFang SC",
  "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .9em; }
.hint { color: var(--muted); font-size: .82em; }
.req { color: var(--danger); }
.center { text-align: center; }

.container { max-width: 1000px; margin: 0 auto; padding: 0 18px; }
main.container { padding-top: 24px; padding-bottom: 40px; min-height: 60vh; }

.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between;
  height: 56px; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 18px; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a:hover { color: var(--primary); text-decoration: none; }
.nav-admin { font-weight: 600; }
.footer { border-top: 1px solid var(--border); background: #fff;
  padding: 14px 0; color: var(--muted); font-size: .85rem; text-align: center; }

.panel { background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.panel h1, .panel h2, .panel h3 { margin-top: 0; }
.side-panel { background: #f8fafc; }

.grid.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
@media (max-width: 780px) { .grid.two-col { grid-template-columns: 1fr; } }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-weight: 600; font-size: .9rem; }
input, select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; }

.btn {
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; background: #e5e9f0; color: var(--text);
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border-color: var(--border); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-row { display: flex; gap: 12px; margin-top: 18px; justify-content: center; flex-wrap: wrap; }

.center-card { max-width: 460px; margin: 24px auto; text-align: center; }
.center-card h1 { margin: 12px 0 6px; }
.big-icon { font-size: 44px; }
.error-card { border: 1px solid #f3c2c2; background: #fff5f5; }

.ticket-no-box {
  background: #f1f5f9; border: 1px dashed var(--border); border-radius: 8px;
  padding: 14px; margin: 16px 0; display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; align-items: center; }
.copyable { cursor: pointer; background: #fff; border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 6px; font-weight: 700; letter-spacing: .5px; }
.alert { background: #fff4e5; border: 1px solid #f5c26b; color: #92590b;
  padding: 9px 13px; border-radius: 8px; margin-bottom: 14px; }

.ticket-header { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 16px; }
.ticket-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px;
  background: #f8fafc; padding: 14px; border-radius: 8px; margin: 14px 0;
  font-size: .9rem; }
.ticket-content { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; text-transform: capitalize; background: #eef2f7; }
.tag-urgent { background: #fee2e2; color: var(--danger); }
.tag-high { background: #ffedd5; color: var(--warn); }
.tag-normal { background: #dbeafe; color: var(--primary); }
.tag-low { background: #e5e9f0; color: var(--muted); }

.status-badge { padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.status-open { background: #fff4e5; color: var(--warn); }
.status-in_progress { background: #dbeafe; color: var(--primary); }
.status-resolved { background: #dcfce7; color: var(--success); }
.status-closed { background: #e5e9f0; color: var(--muted); }

.attach-list { list-style: none; padding: 0; margin: 10px 0; }
.attach-list li { padding: 5px 0; border-bottom: 1px dashed var(--border); }

.reply-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.reply { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.reply.admin-reply { background: #f0f7ff; border-color: #c3ddf5; }
.reply-head { display: flex; justify-content: space-between; margin-bottom: 5px; }
.reply-body { white-space: pre-wrap; }

.flow { padding-left: 18px; }
.flow li { margin: 4px 0; }

/* admin */
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.back-link { font-size: .9rem; color: var(--muted); display: block; margin-bottom: 4px; }
.inline { display: inline; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 780px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; text-align: center; }
.stat-num { font-size: 1.7rem; font-weight: 800; display: block; }
.stat-label { font-size: .82rem; color: var(--muted); }
.status-card-open { border-top: 3px solid var(--warn); }
.status-card-in_progress { border-top: 3px solid var(--primary); }
.status-card-resolved { border-top: 3px solid var(--success); }
.status-card-closed { border-top: 3px solid var(--muted); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; }
.filter-bar input { flex: 1; min-width: 160px; }

.table-panel { padding: 0; overflow: auto; }
.ticket-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ticket-table th, .ticket-table td { text-align: left; padding: 11px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.ticket-table th { background: #f8fafc; font-weight: 700; position: sticky; top: 0; }
.td-title { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: center;
  margin-top: 14px; }

.status-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

/* 公告 */
.announcement {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fff8e6; border: 1px solid #f5d98b;
  border-left: 4px solid #f0b429; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 18px;
}
.announce-icon { font-size: 20px; }
.announce-body { flex: 1; }
.announce-text { white-space: pre-wrap; margin-top: 4px; }
.announce-time { display: block; margin-top: 6px; font-size: .78rem; }
