/* ==================== Reset & Base ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

:root {
  --primary: #4A6CF7;
  --primary-dark: #3A5BD9;
  --primary-light: #EEF2FF;
  --danger: #FF4D4F;
  --danger-light: #FFF1F0;
  --warning: #FA8C16;
  --warning-light: #FFF7E6;
  --success: #52C41A;
  --success-light: #F6FFED;
  --bg: #F5F6FA;
  --card-bg: #FFFFFF;
  --text-main: #1A1A2E;
  --text-sub: #6B7280;
  --text-hint: #9CA3AF;
  --border: #E5E7EB;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
}

a { color: var(--primary); text-decoration: none; }

#app {
  min-height: 100vh;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* ==================== Login Page ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  background: linear-gradient(135deg, #4A6CF7 0%, #6B8AFB 50%, #8AA4FC 100%);
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.login-logo p {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

/* ==================== Forms ==================== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #F9FAFB;
  font-size: 16px;
  color: var(--text-main);
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
  background: #fff;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239CA3AF' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-row .form-group { flex: 1; }

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active { background: var(--primary-dark); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-sub);
  border: 2px solid var(--border);
}

.btn-block {
  width: 100%;
  padding: 15px;
  font-size: 16px;
}

.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==================== Header ==================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header .header-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.header .header-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
}

.header .header-action {
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
}

/* ==================== Search Bar ==================== */
.search-bar {
  padding: 10px 16px;
  background: #fff;
  position: sticky;
  top: 61px;
  z-index: 90;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-hint);
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: var(--bg);
  border-radius: 22px;
  font-size: 14px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.search-input:focus {
  background: #fff;
  border-color: var(--primary);
}

/* ==================== Category Tabs ==================== */
.category-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  background: var(--bg);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.cat-tab.active {
  background: var(--primary);
  color: #fff;
}

/* ==================== Memo Cards ==================== */
.memo-list {
  padding: 12px 16px 100px;
}

.memo-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.memo-card.pinned {
  border-left: 4px solid var(--warning);
}

.memo-card.priority-urgent {
  border-left: 4px solid var(--danger);
}

.memo-card.priority-important {
  border-left: 4px solid var(--warning);
}

.memo-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.memo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-urgent { background: var(--danger-light); color: var(--danger); }
.badge-important { background: var(--warning-light); color: var(--warning); }
.badge-pin { background: var(--warning-light); color: var(--warning); }
.badge-category { background: var(--primary-light); color: var(--primary); }

.memo-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.memo-content {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  margin-bottom: 12px;
}

.memo-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-hint);
  flex-wrap: wrap;
}

.memo-footer .separator {
  color: var(--border);
}

.memo-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.memo-comment-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.memo-comment {
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-sub);
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.memo-comment .comment-author {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.memo-comment .comment-time {
  color: var(--text-hint);
  font-size: 11px;
  margin-left: auto;
  white-space: nowrap;
}

.comment-input-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.comment-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
}

/* ==================== FAB ==================== */
.fab {
  position: fixed;
  bottom: calc(76px + var(--safe-bottom));
  right: 24px;
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(74,108,247,0.4);
  cursor: pointer;
  z-index: 90;
  transition: all 0.2s;
}

.fab:active {
  transform: scale(0.9);
  box-shadow: 0 3px 10px rgba(74,108,247,0.4);
}

/* ==================== Modal ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  animation: slideUp 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

/* ==================== Empty State ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-hint);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state .text {
  font-size: 15px;
}

.empty-state .sub {
  font-size: 13px;
  margin-top: 8px;
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 999;
  max-width: 80%;
  text-align: center;
  animation: toastIn 0.2s ease;
}

.toast.success { background: rgba(82,196,26,0.9); }
.toast.error { background: rgba(255,77,79,0.9); }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

/* ==================== Profile Section ==================== */
.profile-section {
  background: #fff;
  padding: 20px 16px;
  margin-bottom: 8px;
  text-align: center;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
}

.profile-role {
  font-size: 13px;
  color: var(--text-hint);
  margin-top: 4px;
}

/* ==================== Settings List ==================== */
.settings-list {
  background: #fff;
  border-radius: var(--radius);
  margin: 0 16px 12px;
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.settings-item:last-child { border-bottom: none; }

.settings-item:active { background: var(--bg); }

.settings-item .item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 12px;
}

.settings-item .item-label {
  flex: 1;
  font-size: 15px;
}

.settings-item .item-arrow {
  color: var(--text-hint);
  font-size: 14px;
}

/* ==================== Bottom Nav ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 80;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 6px;
  color: var(--text-hint);
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item.active { color: var(--primary); }

.nav-item .nav-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.nav-item .nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* ==================== Detail Page ==================== */
.detail-page {
  min-height: 100vh;
  background: var(--bg);
}

.detail-card {
  background: #fff;
  margin: 12px 16px;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-hint);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.detail-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

/* ==================== Utility ==================== */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ==================== 工作台（任务工单） ==================== */
.header-right { display: flex; align-items: center; gap: 4px; }
.header-refresh { font-size: 20px; color: var(--text-hint); padding: 4px 8px; cursor: pointer; }

/* 标签栏 */
.tabs {
  display: flex; gap: 6px; padding: 10px 16px 4px;
  background: #fff; border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 7px 14px; border-radius: 20px; font-size: 14px; font-weight: 600;
  color: var(--text-sub); background: #F2F4F9; white-space: nowrap; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
}
.tab.active { background: var(--primary); color: #fff; }
.tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #FF4D4F; color: #fff; font-size: 11px; line-height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tab.active .tab-badge { background: rgba(255,255,255,0.28); }

/* 开启提醒横幅 */
.push-banner {
  margin: 10px 16px 0; padding: 11px 14px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #EEF2FF, #E4ECFF);
  border: 1px solid #D6E0FF;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.pb-icon { font-size: 20px; }
.pb-text { flex: 1; display: flex; flex-direction: column; }
.pb-text b { font-size: 14px; color: #2B3B7A; }
.pb-text span { font-size: 12px; color: #6B7BB5; }
.pb-btn {
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 16px;
}

/* 任务卡片 */
.task-list { padding: 12px 16px 90px; display: flex; flex-direction: column; gap: 10px; }
.task-card {
  background: #fff; border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); border-left: 4px solid #D7DCE8;
  cursor: pointer; position: relative;
}
.task-card.st-pending { border-left-color: #FA8C16; }
.task-card.st-doing { border-left-color: #4A6CF7; }
.task-card.st-done { border-left-color: #52C41A; opacity: 0.92; }
.task-card.urgent { box-shadow: 0 2px 14px rgba(255,77,79,0.16); }
.task-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.status-pill {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
}
.status-pill.sp-pending { background: #FFF3E6; color: #D46B08; }
.status-pill.sp-doing { background: #EEF2FF; color: #3A5BD9; }
.status-pill.sp-done { background: #F0FBEA; color: #389E0D; }
.task-title { font-size: 16px; font-weight: 700; line-height: 1.4; color: var(--text-main); }
.task-desc { font-size: 13.5px; color: var(--text-sub); margin-top: 5px; line-height: 1.6; white-space: pre-wrap; }
.task-result {
  font-size: 13.5px; color: #1F7A3D; margin-top: 6px; line-height: 1.6;
  background: #F6FFED; border-radius: 8px; padding: 8px 10px;
}
.task-meta { font-size: 12.5px; color: var(--text-hint); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-meta .dot { color: #D5D9E3; }
.task-meta .overdue { color: #FF4D4F; font-weight: 600; }
.task-foot {
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed #EDEFF5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--text-hint);
}
.task-foot .who { color: #3A5BD9; }
.task-foot .who-done { color: #389E0D; }
.btn-mini {
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 16px;
  cursor: pointer; white-space: nowrap;
}
.btn-claim { background: var(--primary-light); color: var(--primary); }
.btn-done { background: #F0FBEA; color: #389E0D; }

/* 详情增强 */
.student-box {
  margin-top: 14px; background: #F7F9FF; border: 1px solid #E3EAFB;
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.sb-row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; }
.sb-row span { color: var(--text-sub); }
.sb-row b { color: var(--text-main); }
.sb-row a { color: var(--primary); font-weight: 600; }
.result-box {
  margin-top: 14px; background: #F6FFED; border: 1px solid #D3F0B8;
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.rb-title { font-size: 12.5px; color: #389E0D; font-weight: 700; margin-bottom: 4px; }
.rb-body { font-size: 14.5px; color: #1F4D2B; line-height: 1.7; white-space: pre-wrap; }
.doing-box {
  margin-top: 14px; font-size: 13px; color: #3A5BD9; background: #EEF2FF;
  border-radius: 8px; padding: 8px 10px;
}
.op-box { padding: 14px 16px 0; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.hint-text { font-size: 12.5px; color: var(--text-hint); line-height: 1.7; margin: 8px 0 10px; }

/* 快捷标签 */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px; padding: 6px 12px; border-radius: 16px;
  background: #F2F4F9; color: #475569; cursor: pointer; border: 1px solid #E6E9F2;
}
.chip:active { background: var(--primary-light); color: var(--primary); }

/* 员工账号 */
#user-list { padding: 12px 16px 90px; display: flex; flex-direction: column; gap: 10px; }
.user-row {
  background: #fff; border-radius: var(--radius-sm); padding: 12px 14px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px;
}
.ur-main { flex: 1; min-width: 0; }
.ur-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ur-sub { font-size: 12.5px; color: var(--text-hint); margin-top: 2px; }
.ur-ops { display: flex; gap: 12px; font-size: 13px; }
.tag-admin { font-size: 11px; background: #EEF2FF; color: #3A5BD9; padding: 1px 6px; border-radius: 8px; }
.tag-off { font-size: 11px; background: #FFF1F0; color: #FF4D4F; padding: 1px 6px; border-radius: 8px; }

.link { color: var(--primary); cursor: pointer; font-size: 13px; font-weight: 600; }
.item-sub { font-size: 12px; color: var(--text-hint); font-weight: 400; margin-top: 2px; }
.item-sub .ok { color: #389E0D; }
.item-sub .warn { color: #FA8C16; }
.memo-comment.sys { color: var(--text-hint); font-size: 13px; }
