/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #2d2a26;
  --ink-soft: #7a756d;
  --primary: #e07b39;
  --primary-deep: #c4621f;
  --primary-soft: #fdf0e3;
  --line: #ece8e0;
  --green: #4a9d6a;
  --green-soft: #e8f4ec;
  --red: #d0554f;
  --red-soft: #fbeae9;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(45, 42, 38, 0.06);
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}

#app { min-height: 100%; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; font-size: 15px; color: var(--ink); }

/* ========== 通用组件 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: .92; }
.btn-ghost { background: var(--primary-soft); color: var(--primary-deep); }
.btn-block { width: 100%; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted { color: var(--ink-soft); font-size: 13px; }

/* 多行文本渲染 */
.pre-wrap { white-space: pre-wrap; word-break: break-word; }

/* ========== 登录页 ========== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: linear-gradient(180deg, #fdf6ec 0%, var(--bg) 55%);
}
.login-logo {
  width: 84px; height: 84px;
  border-radius: 26px;
  background: linear-gradient(135deg, #f2a65a, var(--primary-deep));
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  box-shadow: 0 10px 24px rgba(196, 98, 31, .25);
  margin-bottom: 18px;
}
.login-title { font-size: 24px; font-weight: 800; text-align: center; }
.login-sub { color: var(--ink-soft); font-size: 14px; text-align: center; margin: 6px 0 30px; }
.login-card { width: 100%; max-width: 400px; }
.login-input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  outline: none;
  transition: border-color .15s;
  background: #fff;
}
.login-input:focus { border-color: var(--primary); }
.login-hint { text-align: center; margin-top: 14px; }
.admin-link {
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.err-tip { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; }

/* ========== 主界面框架 ========== */
.main-wrap { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 78px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246, 244, 239, .92);
  backdrop-filter: blur(10px);
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; font-weight: 800; }
.topbar .who { font-size: 13px; color: var(--primary-deep); font-weight: 600; }

.page { padding: 16px 16px 24px; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 底部导航 */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.bottom-nav .nav-item {
  flex: 1;
  padding: 8px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}
.bottom-nav .nav-item .ico { font-size: 20px; line-height: 1; }
.bottom-nav .nav-item.active { color: var(--primary-deep); font-weight: 700; }
.bottom-nav .nav-item.active .ico { transform: translateY(-1px); }

/* ========== 今日页 ========== */
.day-banner {
  border-radius: var(--radius);
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, #f2a65a, #d4712c);
  box-shadow: 0 8px 20px rgba(196, 98, 31, .22);
  margin-bottom: 16px;
}
.day-banner .tag { font-size: 12px; opacity: .92; font-weight: 600; }
.day-banner .big { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.day-banner .date { font-size: 13px; opacity: .92; }
.day-banner.before { background: linear-gradient(135deg, #8fb9a0, #5e9670); box-shadow: 0 8px 20px rgba(74, 157, 106, .22); }
.day-banner.after { background: linear-gradient(135deg, #a9a29a, #7f7870); box-shadow: 0 8px 20px rgba(0,0,0,.12); }

/* 时间线 */
.session {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 16px;
}
.session:last-child { padding-bottom: 0; }
.session::before {
  content: "";
  position: absolute;
  left: 52px; top: 30px; bottom: -2px;
  width: 2px;
  background: var(--line);
}
.session:last-child::before { display: none; }
.session-time {
  flex-shrink: 0;
  width: 52px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-deep);
  padding-top: 4px;
  line-height: 1.4;
}
.session-body { flex: 1; }
.session-dot {
  position: absolute;
  left: 47px; top: 10px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--primary-soft);
}
.session-title { font-size: 15px; font-weight: 700; padding-left: 14px; }
.session-content {
  margin-top: 4px;
  padding: 10px 12px;
  background: #faf8f3;
  border-radius: 10px;
  font-size: 14px;
  color: #5b564d;
}
.session .time-inline { display: none; }

/* ========== 日程页 ========== */
.day-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: none;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}
.day-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.day-theme { font-size: 17px; font-weight: 800; margin: 2px 0 16px; }
.day-date { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; font-weight: 500; }

/* ========== 了解页 ========== */
.about-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.about-tab {
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.about-tab.active { background: var(--green); border-color: var(--green); color: #fff; }
.about-body { font-size: 14.5px; }

/* ========== 管理端 ========== */
.admin-wrap { max-width: 680px; margin: 0 auto; min-height: 100vh; padding: 18px 16px 40px; }
.admin-login-card { max-width: 420px; margin: 12vh auto 0; }
.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.admin-head h2 { font-size: 20px; font-weight: 800; }
.admin-section { margin-bottom: 18px; }
.admin-section .section-title { font-size: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input[type="text"], .field input[type="date"], .field input[type="password"],
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  background: #fff;
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 96px; }

/* 管理端：日程编辑器 */
.day-edit { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: #fff; }
.day-edit .day-num {
  font-size: 13px; font-weight: 800; color: var(--primary-deep);
  background: var(--primary-soft);
  display: inline-block; padding: 3px 12px; border-radius: 999px; margin-bottom: 12px;
}
.session-edit {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafaf7;
  position: relative;
}
.session-edit .del-session {
  position: absolute; top: 8px; right: 8px;
  color: var(--red); font-size: 12px; font-weight: 700;
  background: var(--red-soft); border-radius: 999px; padding: 2px 10px;
}
.session-edit .field { margin-bottom: 8px; }
.session-edit .field:last-child { margin-bottom: 0; }
.btn-sm {
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-deep);
}
.btn-sm.green { background: var(--green-soft); color: var(--green); }
.btn-sm.red { background: var(--red-soft); color: var(--red); }
.btn-sm.outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink-soft); }

.admin-actions {
  position: sticky; bottom: 0;
  background: var(--bg);
  padding: 12px 0 8px;
  display: flex; gap: 10px;
}

/* 参与名单 */
.participant-list { max-height: 300px; overflow-y: auto; }
.participant-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.participant-item:last-child { border-bottom: none; }
.participant-item .times { font-size: 12px; color: var(--ink-soft); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 96px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(45, 42, 38, .92);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
  z-index: 99;
  max-width: 86%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 加载态 */
.loading { text-align: center; padding: 60px 0; color: var(--ink-soft); font-size: 14px; }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 桌面端加宽 */
@media (min-width: 640px) {
  body { font-size: 16px; }
  .bottom-nav { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}

/* ========== 前台：表单入口与弹窗 ========== */
.form-actions {
  display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 400px;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.modal .field { margin-bottom: 12px; }
.modal select { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px; background: #fff; }
.modal input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.modal input[readonly] { background: #f5f3ee; color: var(--ink-soft); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ========== 后台整体 ========== */
.admin-panel { max-width: 860px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tab {
  padding: 9px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; font-size: 14px; font-weight: 600; color: var(--ink-soft);
}
.admin-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.form-config-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #d8d3ca; border-radius: 999px; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 字段行 */
.field-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap;
}
.field-row input[type="text"], .field-row select {
  border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.field-row .in-label { flex: 1.4; min-width: 100px; }
.field-row .in-type { width: 84px; background: #fff; }
.field-row .in-opts { flex: 1.6; min-width: 120px; }
.field-row .req { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.field-row .req input { width: auto; }

/* 数据表格 */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: nowrap; }
.data-table th { background: #faf8f3; font-weight: 700; color: var(--ink-soft); position: sticky; top: 0; }
.export-btn { text-decoration: none; margin-left: 10px; }
