/* ============================================================
   学生会权益部 · 意见反馈平台
   设计系统：Apple / ChatGPT 简洁风 —— 黑白灰、大圆角、毛玻璃、填充式输入
   ============================================================ */
:root {
  --bg: #f7f7fb;
  --card: #ffffff;
  --fill: #f2f2f7;          /* 输入框 / 分段控件底 */
  --fill-2: #f7f7fb;        /* 卡片内浅灰块 */
  --text: #232742;
  --text-2: #4a5075;
  --muted: #9399b8;
  --border: #ececf4;
  --border-strong: #e0e0ec;
  --primary: #6366f1;       /* 主交互色（靛蓝） */
  --primary-600: #5458e8;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --link: #6366f1;
  --radius: 20px;
  --radius-s: 12px;
  --shadow-sm: 0 1px 2px rgba(90, 90, 180, .04), 0 2px 8px rgba(90, 90, 180, .05);
  --shadow-md: 0 2px 6px rgba(90, 90, 180, .06), 0 10px 30px rgba(90, 90, 180, .08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  /* 分类色（鲜艳） */
  --c-食堂餐饮: #f59e0b;
  --c-宿舍生活: #8b5cf6;
  --c-教学科研: #3b82f6;
  --c-后勤保障: #10b981;
  --c-校园安全: #ef4444;
  --c-其他: #64748b;
  /* 状态 / 紧急色 */
  --紧急: #e5484d;  --一般: #f59e0b;  --建议: #18a058;
  --待处理: #e5484d; --处理中: #f59e0b; --已处理: #18a058;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: .1px;
}
.hidden { display: none !important; }
::selection { background: rgba(0, 0, 0, .1); }
a { color: var(--link); text-decoration: none; }
a:hover { opacity: .8; }

.icon { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; }

/* ============ 顶部导航（毛玻璃） ============ */
.topnav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, .05);
}
.topnav-inner {
  max-width: 1000px; margin: 0 auto; padding: 0 20px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, .35);
}
.brand-text { font-weight: 700; font-size: 15.5px; letter-spacing: .2px; }
.brand-text em {
  display: block; font-style: normal; font-size: 11px; font-weight: 400;
  color: var(--muted); letter-spacing: .3px; margin-top: 1px;
}
.topnav-right { display: flex; align-items: center; gap: 8px; }
#welcome { font-size: 13px; color: var(--muted); }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 999px; font-size: 13.5px; font-weight: 600; color: #fff;
  background: var(--grad); box-shadow: 0 4px 12px rgba(99, 102, 241, .3);
  transition: background .18s ease;
}
.nav-link:hover { background: var(--primary-600); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all .18s ease; white-space: nowrap;
}
.btn-primary {
  width: 100%; margin-top: 20px; padding: 13px; color: #fff;
  background: var(--grad); box-shadow: 0 6px 18px rgba(99, 102, 241, .35);
}
.btn-primary:hover { background: var(--primary-600); transform: translateY(-1px); }
.btn-primary:active { transform: none; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: #fff; border-color: var(--border-strong); color: var(--text);
  border-radius: 999px;
}
.btn-ghost:hover { background: var(--fill); border-color: #d6d6d9; }
.btn-danger {
  background: #fff; border-color: #fecaca; color: var(--紧急); border-radius: 999px;
}
.btn-danger:hover { background: #fef2f2; }

/* ============ 页面头部 ============ */
.page-head { max-width: 1000px; width: 100%; margin: 44px auto 0; padding: 0 20px; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: .2px; }
.page-head p { margin-top: 7px; font-size: 14.5px; color: var(--muted); }

/* ============ 分段控件（iOS segmented） ============ */
.tabs { display: inline-flex; gap: 4px; margin-top: 22px; background: var(--fill); border-radius: 13px; padding: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 22px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--text-2); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .22s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--grad); color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, .35);
}

/* ============ 布局 ============ */
main, .panel { max-width: 1000px; width: 100%; margin: 24px auto; padding: 0 20px; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 30px; box-shadow: var(--shadow-sm);
}
.card.narrow { max-width: 400px; margin: 64px auto; padding: 34px 30px; box-shadow: var(--shadow-md); }
.card + .card { margin-top: 20px; }

.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.section-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, .3);
}
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head p { font-size: 12.5px; color: var(--muted); }

/* ============ 表单（填充式输入） ============ */
.fb-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; margin-top: 20px; }
form label { display: flex; align-items: center; gap: 4px; font-size: 13px; margin: 17px 0 7px; font-weight: 600; color: var(--text-2); }
.req { color: var(--紧急); }
.field { position: relative; }
input, select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid transparent;
  border-radius: var(--radius-s); font-size: 14.5px; font-family: inherit; color: var(--text);
  background: var(--fill); transition: all .18s ease;
}
input:hover, select:hover, textarea:hover { background: #eeeeef; }
input:focus, select:focus, textarea:focus {
  outline: none; background: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.7; }
select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.char-count { position: absolute; right: 13px; bottom: 11px; font-size: 11px; color: var(--muted); pointer-events: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.center { text-align: center; }

/* 侧边流程说明 */
.side-note { align-self: start; }
.flow { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.flow li { display: flex; gap: 12px; align-items: flex-start; }
.flow .step {
  flex-shrink: 0; width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: #fff; background: var(--grad);
}
.flow b { font-size: 13.5px; display: block; }
.flow span { font-size: 12.5px; color: var(--muted); line-height: 1.6; }

/* ============ 看板 ============ */
.board-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.board-stats { font-size: 12.5px; color: var(--muted); }
.board-stats b { color: var(--text); font-size: 15px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; }
.search-box input { width: 220px; padding: 9px 13px 9px 34px; font-size: 13.5px; border-radius: 999px; }
.search-box input:focus { border-color: var(--primary); }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar select { width: auto; min-width: 112px; padding: 9px 34px 9px 13px; font-size: 13.5px; border-radius: 999px; }

.board-list { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }

.fb-item {
  position: relative; background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px 15px; transition: box-shadow .2s ease, border-color .2s ease;
}
.fb-item:hover { box-shadow: var(--shadow-md); border-color: transparent; }
.fb-item::before {
  content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 3px;
  background: var(--cat-color, var(--primary));
}
.fb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fb-title { font-weight: 650; font-size: 15.5px; line-height: 1.5; }
.fb-code { font-size: 11px; color: var(--muted); white-space: nowrap; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 11px 0; }
.tag {
  font-size: 11.5px; padding: 3px 11px; border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px; line-height: 1.6;
}
.tag.cat { background: color-mix(in srgb, var(--cat-color, #0d0d0d) 10%, #fff); color: var(--cat-color, #0d0d0d); }
.tag.紧急, .tag.待处理 { background: #fef2f2; color: var(--紧急); }
.tag.一般, .tag.处理中 { background: #fffbeb; color: var(--一般); }
.tag.建议, .tag.已处理 { background: #ecfdf5; color: var(--已处理); }
.fb-content { font-size: 13.5px; line-height: 1.75; color: var(--text-2); white-space: pre-wrap; }
.fb-handling {
  margin-top: 12px; padding: 11px 14px; border-radius: 12px;
  background: linear-gradient(135deg, #fff0f0, #fef3f3);
  border: 1px solid #ffd9d9;
  font-size: 13px; line-height: 1.7;
  display: flex; gap: 8px; color: #d03333;
}
.fb-handling .icon { margin-top: 2px; color: var(--紧急); }
.fb-meta { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }

/* 追问 */
.fu-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.fu-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px;
  background: #fdf3f3; border: 1px solid #ffdddd; border-radius: 10px;
  font-size: 13px; line-height: 1.6;
}
.fu-tag {
  flex-shrink: 0; font-size: 11px; font-weight: 700; color: #d03333;
  background: #fff; border: 1px solid #ffc9c9; border-radius: 6px; padding: 1px 7px;
}
.fu-text { flex: 1; color: var(--text-2); white-space: pre-wrap; }
.fu-time { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.fu-editor { margin-top: 12px; }
.fu-editor .fu-input { width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.fu-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.fu-limit { margin-top: 12px; font-size: 12px; color: var(--muted); }

.skeleton { display: flex; flex-direction: column; gap: 12px; }
.skeleton .sk {
  height: 112px; border-radius: 16px;
  background: linear-gradient(100deg, #f0f0f2 40%, #f7f7f8 50%, #f0f0f2 60%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); font-size: 13.5px; }
.empty .icon { width: 40px; height: 40px; color: #d9d9de; margin-bottom: 10px; }

/* ============ Toast ============ */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translate(-50%, -120px);
  z-index: 100; display: flex; align-items: center; gap: 9px;
  background: var(--primary); color: #fff; border-radius: 999px; padding: 11px 20px;
  box-shadow: 0 10px 30px rgba(99, 102, 241, .4); font-size: 13.5px; font-weight: 500;
  transition: transform .4s cubic-bezier(.22, .8, .3, 1); max-width: 88vw;
}
.toast.show { transform: translate(-50%, 0); }
.toast.ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.toast.fail::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #f87171; }

/* ============ 后台两列布局 ============ */
.admin-layout {
  display: grid; grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px; align-items: start;
}
.admin-left, .admin-right { min-width: 0; }
.admin-left .card, .admin-right .card { margin: 0; }
.admin-left .card { position: sticky; top: 76px; }
.admin-left .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-left .stat { padding: 14px 14px 12px; }
.admin-left .stat b { font-size: 22px; }
.admin-left .charts { grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
.admin-left .donut-wrap { flex-direction: column; align-items: center; }
.admin-left .donut-legend { width: 100%; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.stat {
  border-radius: 14px; padding: 16px 16px 14px;
  background: var(--fill-2);
  display: flex; flex-direction: column; gap: 3px;
  transition: transform .18s ease, background .18s ease;
}
.stat:hover { transform: translateY(-2px); background: #f1f1f3; }
.stat .stat-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 7px; }
.stat b { font-size: 25px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.blue .stat-ico { background: #e8edff; color: #4f46e5; }
.stat.red .stat-ico { background: #feecec; color: #e02020; }
.stat.orange .stat-ico { background: #fef6e7; color: #d97706; }
.stat.green .stat-ico { background: #e7f8f1; color: #0a9d6c; }
.stat.dark .stat-ico { background: #ececef; color: #3f3f46; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.chart-box { background: var(--fill-2); border-radius: 16px; padding: 18px; }
.chart-box h3 { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.chart-box.full { grid-column: 1 / -1; }

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend-row .lg-name { flex: 1; color: var(--text-2); }
.legend-row .lg-val { font-weight: 700; color: var(--text); }
.legend-row .lg-pct { color: var(--muted); font-size: 11.5px; width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12.5px; }
.bar-label { width: 44px; color: var(--text-2); text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; background: #ebebee; border-radius: 999px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--grad); transition: width .8s cubic-bezier(.22, .8, .3, 1); min-width: 4px; }
.bar-num { width: 24px; color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }

.mg-item { border-radius: 16px; border: 1px solid var(--border); padding: 16px 18px; margin-bottom: 12px; background: #fff; transition: box-shadow .2s ease; }
.mg-item:hover { box-shadow: var(--shadow-md); border-color: transparent; }
.mg-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mg-actions { display: flex; gap: 8px; flex-shrink: 0; }
.mg-title { font-weight: 650; font-size: 14.5px; line-height: 1.5; }
.mg-contact { font-size: 12px; color: var(--muted); margin-top: 7px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px;
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 22px; padding: 26px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow: auto; box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
  animation: pop .3s cubic-bezier(.22, .8, .3, 1) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 12px; }
.modal-content {
  background: var(--fill-2); border-radius: 12px; padding: 12px 14px;
  font-size: 13.5px; line-height: 1.75; margin-bottom: 4px;
  white-space: pre-wrap; color: var(--text-2);
}
.modal .check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; margin-top: 16px; cursor: pointer; }
.modal .check input { width: auto; accent-color: var(--primary); }
.modal-actions { display: flex; justify-content: space-between; margin-top: 20px; }
.modal-actions span { display: flex; gap: 8px; }

/* ============ PDF 导出视图 ============ */
.export-area {
  position: absolute; left: -9999px; top: 0; width: 760px;
  background: #fff; padding: 32px; font-family: var(--font);
}
.export-report { color: #1f2937; }
.export-title { font-size: 20px; font-weight: 800; text-align: center; }
.export-sub { font-size: 12px; color: #6b7280; text-align: center; margin-top: 4px; margin-bottom: 16px; }
.export-stats { display: flex; gap: 10px; margin-bottom: 18px; }
.export-stat { flex: 1; text-align: center; padding: 10px 6px; border-radius: 8px; background: #f3f4f6; border: 1px solid #e5e7eb; }
.export-stat b { display: block; font-size: 20px; font-weight: 800; }
.export-stat span { font-size: 11px; color: #6b7280; }
.export-h { font-size: 14px; font-weight: 700; margin: 14px 0 8px; padding-bottom: 6px; border-bottom: 2px solid #6366f1; }
.export-dist { font-size: 12.5px; color: #374151; line-height: 1.8; }
.export-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.export-table th, .export-table td { border: 1px solid #d9dce5; padding: 8px 9px; text-align: left; vertical-align: top; line-height: 1.6; }
.export-table th { background: #f1f2f8; font-weight: 700; white-space: nowrap; }
.export-table td .t { font-weight: 700; font-size: 12.5px; }
.export-table td .c { color: #64748b; white-space: pre-wrap; }
.export-table .e-紧急 { color: #dc2626; font-weight: 600; }
.export-table .e-一般 { color: #d97706; font-weight: 600; }
.export-table .e-建议 { color: #059669; font-weight: 600; }
.export-item { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.export-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.export-item-head .code { font-size: 11px; color: #6b7280; margin-right: auto; }
.export-item-title { font-weight: 700; font-size: 13.5px; margin-bottom: 5px; }
.export-item-content { font-size: 12.5px; color: #374151; line-height: 1.7; white-space: pre-wrap; }
.export-item-handling { font-size: 12px; color: #3730a3; background: #eef2ff; border-radius: 6px; padding: 6px 9px; margin-top: 7px; }
.export-tag { font-size: 11px; padding: 2px 8px; border-radius: 5px; font-weight: 600; }
.export-tag.cat { background: #eef2ff; color: #4f46e5; }
.export-tag.紧急, .export-tag.待处理 { background: #fef2f2; color: #dc2626; }
.export-tag.一般, .export-tag.处理中 { background: #fffbeb; color: #d97706; }
.export-tag.建议, .export-tag.已处理 { background: #ecfdf5; color: #059669; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 0 24px; margin-top: auto; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-left .card { position: static; }
}
@media (max-width: 640px) {
  .fb-layout { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 22px; }
  .page-head { margin-top: 30px; }
  .page-head h1 { font-size: 23px; }
  .search-box input { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar .search-box { flex: 1; }
  .topnav-inner { height: 54px; }
}
