:root {
  --primary: #5c388d;
  --primary-light: #f4eefb;
  --primary-border: #dfd0ef;
  --primary-hover: #482a72;
  --accent: #e5a823;
  --success: #16a34a;
  --success-light: #edfcf2;
  --paper-bg: #f5f2eb;
  --paper-card: #ffffff;
  --paper-border: #e6dfd3;
  --text-main: #1f1f1f;
  --text-muted: #6b6357;
  --font-editorial: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Menlo", "Courier New", monospace;
  --shadow-sm: 0 2px 8px rgba(50, 40, 30, 0.05);
  --shadow-md: 0 4px 16px rgba(50, 40, 30, 0.08);
}

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

body {
  font-family: var(--font-editorial);
  background-color: var(--paper-bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================ */
/* PURE PARENT DETAIL LONG-IMAGE DISPLAY (ONLY 7 IMAGES)        */
/* ============================================================ */

#parent-pure-image-flow {
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  line-height: 0;
  font-size: 0;
}

.parent-pure-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: top;
  line-height: 0;
}

/* ============================================================ */
/* TEACHER PATROL WORKSPACE (DINGTALK MOBILE DEDICATED)         */
/* ============================================================ */

.teacher-app-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 12px 14px 40px;
}

/* Top Header */
.teacher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-muted);
}

.live-sync-pill {
  font-size: 11px;
  color: var(--success);
  background: var(--success-light);
  border: 1px solid rgba(22, 163, 74, 0.2);
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 1. Teacher Identity Card */
.teacher-id-card {
  background: #ffffff;
  border: 1px solid var(--primary-border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.teacher-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.teacher-avatar {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  color: var(--primary);
  border: 2px solid var(--primary-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.teacher-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teacher-meta-name {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 4px;
}

.teacher-meta-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-light);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(22, 163, 74, 0.2);
  margin-top: 4px;
}

.switch-teacher-btn {
  background: #ffffff;
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 2. Area Banner */
.area-patrol-banner {
  background: #ffffff;
  border: 1px solid var(--paper-border);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.area-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.area-icon-box {
  width: 38px;
  height: 38px;
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.area-title-text {
  font-size: 15px;
  font-weight: 800;
  color: #222;
}

.area-code-text {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.patrol-type-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

/* 3. Form Section Card */
.form-section-card {
  background: #ffffff;
  border: 1px solid var(--paper-border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.form-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f2ede4;
}

.form-header-title {
  font-size: 14px;
  font-weight: 800;
  color: #222;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-pass-btn {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  border: none;
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.quick-pass-btn:active {
  transform: scale(0.96);
}

/* Checklist Items */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: #faf8f5;
  border: 1px solid var(--paper-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.check-item-row.checked {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.check-box-icon {
  width: 20px;
  height: 20px;
  border: 2px solid #b8af9f;
  border-radius: 5px;
  margin-top: 1px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: transparent;
  background: #ffffff;
  transition: all 0.15s;
}

.check-item-row.checked .check-box-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.check-text-content {
  font-size: 13px;
  color: #333333;
  line-height: 1.45;
}

.check-item-row.checked .check-text-content {
  color: #1a1a1a;
  font-weight: 600;
}

/* Photo Upload */
.photo-upload-area {
  border: 2px dashed #c9bfb0;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  background: #faf8f5;
  cursor: pointer;
  display: block;
}

.photo-upload-area:active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.photo-grid-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.photo-thumb-item {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--paper-border);
}

.photo-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Ratings */
.ratings-2col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rating-card {
  background: #faf8f5;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--paper-border);
}

.rating-card-label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
}

.rating-stars-list {
  color: #f59e0b;
  font-size: 17px;
  margin-top: 2px;
  letter-spacing: 2px;
}

/* Textarea */
.form-input-box {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--paper-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: #222;
  background: #ffffff;
}

/* Submit Action Button */
.patrol-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #5c388d 0%, #4a2c75 100%);
  color: #ffffff;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(92, 56, 141, 0.3);
  margin-top: 8px;
  transition: transform 0.1s, opacity 0.2s;
}

.patrol-submit-btn:active {
  transform: scale(0.98);
}

.patrol-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0,0,0,0.25);
  padding: 24px 20px;
  text-align: center;
}

/* Staff Switch List */
.staff-switch-modal-body {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 16px;
  text-align: left;
}

.staff-switch-option {
  padding: 10px 12px;
  background: #faf8f5;
  border: 1px solid var(--paper-border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.staff-switch-option:active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(30, 25, 35, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  transition: transform 0.25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
}