:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --primary: #2f7cf6;
  --primary-d: #1c63d4;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #eceef1;
  --danger: #e54d42;
  --ok: #2bb673;
  --warn: #f5a623;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }

.app-header {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, var(--primary), #5a9bff);
  color: #fff; padding: 18px 16px 14px;
}
.app-header h1 { margin: 0; font-size: 18px; font-weight: 600; }
.app-header .sub { margin-top: 4px; font-size: 12px; opacity: .85; }

.container { padding: 14px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  padding: 14px; margin-bottom: 12px;
}
.activity-item { cursor: pointer; transition: transform .05s; }
.activity-item:active { transform: scale(.99); }
.activity-item .title { font-size: 16px; font-weight: 600; }
.activity-item .date { color: var(--primary); font-weight: 600; margin-top: 6px; font-size: 14px; }
.activity-item .desc { color: var(--muted); font-size: 13px; margin-top: 6px; }
.activity-item .meta { color: var(--muted); font-size: 12px; margin-top: 8px; display: flex; gap: 12px; }

.section-title {
  font-size: 14px; font-weight: 600; color: var(--muted);
  margin: 14px 4px 8px; display: flex; align-items: center; gap: 6px;
}
.section-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.section-title.afternoon .dot { background: var(--warn); }

.slots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  background: #f0f6ff; border: 1px solid #dbe9ff; border-radius: 10px;
  padding: 10px 6px; text-align: center; cursor: pointer; transition: .1s;
}
.slot .time { font-weight: 600; font-size: 14px; }
.slot .left { font-size: 11px; color: var(--muted); margin-top: 3px; }
.slot:active { transform: scale(.97); }
.slot.full { background: #f3f4f6; border-color: #e6e8eb; color: var(--muted); cursor: not-allowed; }
.slot.full .left { color: #c0392b; }

.btn {
  display: block; width: 100%; border: none; border-radius: 12px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 600;
  padding: 13px; cursor: pointer; transition: .1s;
}
.btn:active { background: var(--primary-d); }
.btn:disabled { background: #b9c6da; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: var(--danger); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 15px; background: #fafbfc; color: var(--text);
}
.divider { display: flex; align-items: center; gap: 8px; margin: 16px 0 12px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
.field .err { color: var(--danger); font-size: 12px; margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input { border-color: var(--danger); }

.back { color: #fff; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.hidden { display: none !important; }
.toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 14px 20px; border-radius: 12px;
  font-size: 15px; z-index: 100; max-width: 80%; text-align: center; opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.ok { background: rgba(43,182,115,.95); }
.toast.err { background: rgba(229,77,66,.95); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

.success-box { text-align: center; padding: 30px 10px; }
.success-box .icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff;
  font-size: 34px; line-height: 64px; margin: 0 auto 16px;
}
.success-box h2 { margin: 0 0 8px; font-size: 20px; }
.success-box p { color: var(--muted); margin: 4px 0; white-space: pre-line; }
.code-box {
  margin: 16px auto 0; display: inline-block; padding: 10px 16px;
  background: #eef4ff; color: #1f5fd6; border: 1px dashed #9fc0f5; border-radius: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: .3px;
}

/* 后台 */
.admin-wrap { max-width: 720px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { color: var(--muted); font-weight: 500; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.tag.open { background: #e7f7ee; color: var(--ok); }
.tag.closed { background: #fdeaea; color: var(--danger); }
.login-box { max-width: 320px; margin: 60px auto; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--text);
}
.mini-btn.primary { border-color: var(--primary); color: var(--primary); }
.mini-btn.danger { border-color: var(--danger); color: var(--danger); }
.slot-edit-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.slot-edit-row input { width: 64px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; width: 100%; max-width: 480px; border-radius: 16px;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal .close { float: right; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; }

/* 日期选择条 */
.date-bar { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.05); padding: 12px 12px 14px; margin-bottom: 14px; }
.date-bar-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; padding-left: 2px; }
.date-chips { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.date-chips::-webkit-scrollbar { display: none; }
.date-chip {
  flex: 0 0 auto; min-width: 56px; text-align: center; padding: 8px 6px;
  border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; cursor: pointer;
  transition: all .15s;
}
.date-chip .d { font-size: 15px; font-weight: 600; }
.date-chip .w { font-size: 11px; color: var(--muted); margin-top: 2px; }
.date-chip.active { background: var(--primary); border-color: var(--primary); }
.date-chip.active .d, .date-chip.active .w { color: #fff; }

/* 星期多选 */
.weekday-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.wd { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; color: var(--text); cursor: pointer; }
.wd input { margin: 0; }
