/* 敬文班意见反馈与干部监督平台 —— 与选举站同一套视觉语言 */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --red-700: #b91c1c; --red-600: #dc2626; --red-500: #ef4444;
  --red-100: #fee2e2; --red-50: #fef2f2; --red-900: #450a0a;
  --panel-bg: #140404;
  --ink: #1d1d1f; --muted: #86868b; --line: #e5e5e7;
  --green-700: #166534; --green-50: #f0fdf4;
  --amber-700: #92400e; --amber-50: #fffbeb;
  --blue-700: #1d4ed8; --blue-50: #eff6ff;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background: #f7f5f4; color: var(--ink); -webkit-font-smoothing: antialiased; min-height: 100vh;
}
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 顶部导航 ===== */
.top-nav { background: var(--panel-bg); padding: 0 32px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.nav-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nav-brand img { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 1px 4px rgba(185,28,28,.2)); }
.nav-brand-text { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-brand-text span { color: rgba(255,255,255,.45); font-weight: 400; margin-left: 8px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.12); }
.nav-user { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.75); font-size: 13px; white-space: nowrap; }
.nav-user .name { color: #fff; font-weight: 600; }
.nav-user a, .nav-user button { color: rgba(255,255,255,.75); background: none; border: 1px solid rgba(255,255,255,.25); border-radius: 20px; padding: 5px 14px; font-size: 13px; cursor: pointer; text-decoration: none; font-family: inherit; transition: background .2s, color .2s; }
.nav-user a:hover, .nav-user button:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ===== 标签栏 ===== */
.tab-bar { background: #fff; border-bottom: 1px solid var(--line); display: flex; gap: 4px; padding: 0 28px; position: sticky; top: 60px; z-index: 40; overflow-x: auto; }
.tab-item { border: none; background: none; font-family: inherit; font-size: 14px; font-weight: 500; color: var(--muted); padding: 14px 16px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .2s; }
.tab-item:hover { color: var(--ink); }
.tab-item.active { color: var(--red-700); border-bottom-color: var(--red-700); font-weight: 600; }
.tab-item .badge { display: inline-block; min-width: 18px; padding: 1px 5px; margin-left: 5px; border-radius: 10px; background: var(--red-600); color: #fff; font-size: 11px; font-weight: 600; text-align: center; }

/* ===== 页面骨架 ===== */
.page-container { max-width: 920px; margin: 0 auto; padding: 28px 22px 60px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: riseIn .35s cubic-bezier(.22,.72,.24,1) both; }
.section-title { font-size: 24px; font-weight: 700; letter-spacing: .3px; }
.section-desc { font-size: 14px; color: var(--muted); line-height: 1.8; margin: 8px 0 20px; }
.hero-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.card { background: #fff; border: 1px solid rgba(69,10,10,.07); border-radius: 22px; padding: 24px; margin-bottom: 18px; box-shadow: 0 10px 30px -18px rgba(69,10,10,.18), 0 1px 4px rgba(28,25,23,.04); animation: cardIn .45s cubic-bezier(.22,.72,.24,1) both; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; letter-spacing: .3px; }
.card-title .icon { color: var(--red-700); }
.rules { padding-left: 22px; }
.rules li { font-size: 14px; line-height: 2; color: #44403c; }

/* ===== 表单 ===== */
.form-field { margin-bottom: 18px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.form-label .required { color: var(--red-600); }
.word-count { float: right; font-size: 12px; color: var(--muted); font-weight: 400; }
.form-input, .form-select, .form-textarea {
  width: 100%; border: 1px solid #d2d2d7; border-radius: 12px; padding: 11px 14px;
  font-size: 16px; color: var(--ink); background: #fff; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--red-700); box-shadow: 0 0 0 3px rgba(185,28,28,.08); }
.form-input::placeholder, .form-textarea::placeholder { color: #c7c7cc; }
.form-input:disabled { background: #f5f5f4; color: var(--muted); }
.form-textarea { min-height: 130px; resize: vertical; line-height: 1.7; }
.form-hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 6px; }

.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-option { border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s, transform .1s; background: #fff; }
.type-option:hover { border-color: #fca5a5; }
.type-option.selected { border-color: var(--red-700); background: var(--red-50); }
.type-option .t-name { display: block; font-size: 15px; font-weight: 700; }
.type-option .t-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.type-option.selected .t-name { color: var(--red-700); }

.anon-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fcfcfb; }
.anon-row .a-title { font-size: 14px; font-weight: 600; }
.anon-row .a-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.switch { position: relative; width: 46px; height: 26px; flex: none; border-radius: 13px; background: #d2d2d7; border: none; cursor: pointer; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--red-600); }
.switch.on::after { transform: translateX(20px); }

.upload-area { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1.5px dashed #d2d2d7; border-radius: 14px; padding: 22px 14px; cursor: pointer; color: var(--muted); transition: border-color .2s, background .2s; text-align: center; }
.upload-area:hover { border-color: var(--red-700); background: var(--red-50); }
.upload-icon { font-size: 22px; }
.upload-text { font-size: 14px; }
.upload-hint { font-size: 12px; }
.image-previews { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.image-previews .thumb { position: relative; width: 86px; height: 86px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.image-previews .thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-previews .thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; cursor: pointer; line-height: 1; }

/* ===== 按钮 ===== */
.btn { padding: 11px 22px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #44403c; cursor: pointer; font-family: inherit; transition: background .2s, border-color .2s, transform .1s, color .2s; }
.btn:hover { background: #f5f5f4; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--red-700); border-color: var(--red-700); color: #fff; }
.btn-primary:hover { background: #991b1b; }
.btn-ghost { color: var(--red-700); border-color: var(--red-100); }
.btn-ghost:hover { background: var(--red-50); }
.btn-danger { color: var(--red-700); border-color: var(--red-100); }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.btn-row.center { justify-content: center; margin-top: 16px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.push-right { margin-left: auto; }
.gate-icon { font-size: 34px; }
.btn-link { text-decoration: none; display: inline-block; }
.result-card { text-align: center; }
.result-icon { font-size: 40px; }
.result-title { font-size: 19px; margin: 10px 0 6px; }
.result-hint { margin-bottom: 16px; }
.btn:focus-visible, .tab-item:focus-visible, .switch:focus-visible, .type-option:focus-visible { outline: 3px solid rgba(185,28,28,.25); outline-offset: 2px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 6px; }

/* ===== 标签与状态 ===== */
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-opinion { background: var(--blue-50); color: var(--blue-700); }
.tag-suggestion { background: var(--green-50); color: var(--green-700); }
.tag-report { background: var(--red-50); color: var(--red-700); }
.tag-pending { background: var(--amber-50); color: var(--amber-700); }
.tag-accepted { background: var(--blue-50); color: var(--blue-700); }
.tag-processing { background: #f5f3ff; color: #6d28d9; }
.tag-resolved { background: var(--green-50); color: var(--green-700); }
.tag-rejected { background: #f5f5f4; color: #57534e; }
.tag-anon { background: #f5f5f4; color: #57534e; }
.tag-public { background: var(--green-50); color: var(--green-700); }

/* ===== 列表与空态 ===== */
.ticket-list { display: grid; gap: 12px; }
.ticket-item { background: #fff; border: 1px solid rgba(69,10,10,.07); border-radius: 18px; padding: 16px 20px; cursor: pointer; transition: box-shadow .2s, transform .15s; animation: riseIn .3s both; }
.ticket-item:hover { box-shadow: 0 10px 26px -14px rgba(69,10,10,.25); transform: translateY(-1px); }
.ticket-item .t-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket-item .t-title { font-size: 15px; font-weight: 600; margin: 8px 0 4px; }
.ticket-item .t-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 40px 20px; border: 1.5px dashed var(--line); border-radius: 18px; background: #fcfcfb; line-height: 1.9; }
.gate { text-align: center; padding: 44px 24px; }
.gate p { color: var(--muted); font-size: 14px; line-height: 1.9; margin: 10px 0 20px; }

/* ===== 查询码 ===== */
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 26px; letter-spacing: 3px; background: var(--red-50); border: 1px dashed var(--red-100); padding: 16px 20px; border-radius: 14px; color: var(--red-900); text-align: center; user-select: all; }
.track-form { display: flex; gap: 10px; }
.track-form .form-input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; }

/* ===== 详情弹窗 ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,4,4,.45); z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px 16px; overflow-y: auto; backdrop-filter: blur(3px); }
.modal-card { background: #fff; border-radius: 24px; width: min(100%, 760px); padding: 28px; position: relative; animation: cardIn .3s cubic-bezier(.22,.72,.24,1) both; margin-bottom: 40px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 17px; color: var(--muted); cursor: pointer; z-index: 2; }
.modal-close:hover { background: #f5f5f4; color: var(--ink); }
.detail-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; padding-right: 40px; }
.detail-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.detail-meta { font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-content { font-size: 15px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; background: #fcfcfb; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.detail-images { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.detail-images img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }
.thread { margin-top: 18px; display: grid; gap: 10px; }
.msg { border-radius: 14px; padding: 12px 16px; font-size: 14px; line-height: 1.8; max-width: 92%; }
.msg .m-meta { font-size: 12px; opacity: .65; margin-bottom: 4px; }
.msg-user { background: #f5f5f4; color: var(--ink); justify-self: start; border-bottom-left-radius: 4px; }
.msg-admin { background: var(--red-50); color: var(--red-900); justify-self: end; border-bottom-right-radius: 4px; }
.msg-internal { background: var(--amber-50); color: var(--amber-700); justify-self: end; border-bottom-right-radius: 4px; border: 1px dashed #fcd34d; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.timeline summary { font-size: 13px; color: var(--muted); cursor: pointer; }
.timeline ol { list-style: none; margin-top: 10px; }
.timeline li { font-size: 13px; color: #57534e; padding: 4px 0 4px 18px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: #d2d2d7; }
.timeline li span { color: var(--muted); font-size: 12px; margin-left: 8px; }
.reply-area { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.admin-actions { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-actions .label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.internal-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }

/* ===== 管理台 ===== */
.sub-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.sub-tab { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 18px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; font-family: inherit; }
.sub-tab.active { background: var(--panel-bg); border-color: var(--panel-bg); color: #fff; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar .form-select, .filter-bar .form-input { width: auto; font-size: 14px; padding: 8px 12px; }
.filter-bar .form-input { flex: 1; min-width: 140px; }
.banner { border: 1px solid var(--red-100); background: var(--red-50); color: var(--red-900); border-radius: 14px; padding: 12px 16px; font-size: 13px; margin-bottom: 16px; line-height: 1.8; }
.banner.plain { border-color: var(--line); background: #fcfcfb; color: #57534e; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid rgba(69,10,10,.07); border-radius: 16px; padding: 16px 18px; }
.stat-card b { display: block; font-size: 26px; font-weight: 700; }
.stat-card span { font-size: 12px; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.bar-row .b-label { color: #44403c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #f5f5f4; border-radius: 8px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 8px; background: var(--red-600); min-width: 2px; transition: width .5s cubic-bezier(.22,.72,.24,1); }
.bar-fill.green { background: #16a34a; }
.bar-fill.blue { background: #2563eb; }
.bar-fill.amber { background: #d97706; }
.bar-fill.purple { background: #7c3aed; }
.bar-fill.gray { background: #a8a29e; }
.bar-row .b-num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding-top: 10px; }
.trend .t-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.trend .t-bar { width: 100%; max-width: 34px; background: var(--red-600); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.trend .t-date { font-size: 10px; color: var(--muted); white-space: nowrap; }
.trend .t-n { font-size: 10px; color: #44403c; }
.event-list { font-size: 13px; }
.event-list .ev { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f5f5f4; color: #44403c; flex-wrap: wrap; }
.event-list .ev:last-child { border-bottom: none; }
.event-list .ev time { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ===== 建议墙 ===== */
.wall-card { background: #fff; border: 1px solid rgba(69,10,10,.07); border-radius: 20px; padding: 22px 24px; margin-bottom: 16px; animation: riseIn .35s both; }
.wall-card .w-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.wall-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.wall-card .w-content { font-size: 14px; line-height: 1.9; color: #44403c; white-space: pre-wrap; overflow-wrap: anywhere; }
.wall-card .w-meta { font-size: 12px; color: var(--muted); margin-top: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.wall-replies { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 8px; }
.wall-reply { background: var(--red-50); border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.8; color: var(--red-900); }
.wall-reply .r-meta { font-size: 11px; opacity: .65; margin-bottom: 2px; }

/* ===== 提示条 ===== */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px); padding: 12px 22px; border-radius: 12px; font-size: 15px; opacity: 0; transition: all .3s; pointer-events: none; z-index: 120; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green-50); border: 1px solid #bbf7d0; color: var(--green-700); }
.toast.error { background: var(--red-50); border: 1px solid #fecaca; color: var(--red-900); }

.page-foot { text-align: center; padding: 0 16px 26px; font-size: 12px; color: #b8b2ae; }
.page-foot a { color: #b8b2ae; text-decoration: none; }
.page-foot a:hover { color: var(--red-700); }

@media (max-width: 640px) {
  .top-nav { padding: 0 16px; }
  .nav-brand-text span { display: none; }
  .tab-bar { padding: 0 10px; top: 60px; }
  .tab-item { padding: 12px 12px 10px; font-size: 13px; }
  .page-container { padding: 20px 14px 48px; }
  .card { border-radius: 18px; padding: 18px 16px; }
  .type-grid { grid-template-columns: 1fr; }
  .type-option { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; }
  .type-option .t-desc { margin-top: 0; }
  .modal-card { padding: 22px 16px; border-radius: 20px; }
  .track-form { flex-direction: column; }
  .code-box { font-size: 21px; letter-spacing: 2px; }
  .bar-row { grid-template-columns: 88px 1fr 40px; }
  .msg { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}