/* 员工端移动端样式 */

:root {
  --primary: #a64b2a;
  --primary-light: #f3dfd6;
  --primary-dark: #7a341d;
  --bg: #f4efe7;
  --surface: #fffdf9;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e7dccd;
  --success: #1f7a4f;
  --success-light: #dff3e8;
  --warning: #a14c16;
  --warning-light: #f8e4d6;
  --error: #dc2626;
  --error-light: #fee2e2;
  --info: #2563eb;
  --shadow: 0 4px 20px rgba(72, 43, 26, 0.08);
  --shadow-lg: 0 8px 30px rgba(166, 75, 42, 0.12);
}

body.staff-mobile {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.staff-container {
  max-width: 430px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 90px;
  min-height: 100vh;
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Header ===== */
.staff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 8px;
}

.staff-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 8px;
  position: relative;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--surface);
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s;
  box-shadow: var(--shadow);
}

.icon-btn:active {
  transform: scale(0.92);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--error);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== Stats Cards ===== */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
  border: 1px solid var(--line);
}

.stat-card:active {
  transform: scale(0.97);
}

.stat-card.urgent {
  background: var(--error-light);
  border-color: #fecaca;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-card.urgent .stat-number {
  color: var(--error);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.risk-panel {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff6f5 0%, #fffdf9 100%);
  border: 1px solid #f1cbc7;
  box-shadow: var(--shadow);
}

.risk-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.risk-panel-label {
  font-size: 12px;
  color: var(--error);
  font-weight: 700;
}

.risk-panel-head strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  color: var(--ink);
}

.risk-panel-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: white;
  border: 1px solid #f1cbc7;
  color: var(--error);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.risk-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.risk-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}

.risk-card-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.risk-card strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  color: var(--ink);
}

.risk-card p {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.risk-card.danger {
  border-color: #efb0b0;
  background: #fff5f5;
}

.risk-card.warn {
  border-color: #f3c79f;
  background: #fff8f2;
}

.risk-card.ok {
  border-color: #b9e1ca;
  background: #f3fbf6;
}

/* ===== Filter Section ===== */
.filter-section {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-section::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
  color: var(--ink);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== Task List ===== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Task Card ===== */
.task-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.task-card:active {
  transform: scale(0.98);
}

.task-card.urgent {
  border: 2px solid var(--error);
}

/* New task arrival animation */
.task-card.new-arrival {
  animation: slideInShake 0.6s ease-out;
}

@keyframes slideInShake {
  0% { transform: translateX(-100%); opacity: 0; }
  50% { transform: translateX(4px); opacity: 1; }
  60% { transform: translateX(-3px); }
  70% { transform: translateX(2px); }
  80% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

.new-task-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--error), #f59e0b, var(--error));
  background-size: 200% 100%;
  animation: glowSlide 1.5s infinite linear;
}

@keyframes glowSlide {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.task-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.task-icon.repair { background: #dbeafe; }
.task-icon.complaint { background: #fce7f3; }
.task-icon.service { background: #d1fae5; }
.task-icon.cleaning { background: #fef3c7; }

.task-meta h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.task-meta p {
  font-size: 12px;
  color: var(--muted);
}

.task-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.badge {
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.badge.urgent {
  background: var(--error-light);
  color: var(--error);
}

.badge.new {
  background: #dbeafe;
  color: var(--info);
}

.badge.waiting {
  background: #fef3c7;
  color: var(--warning);
}

.task-body {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.task-desc {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.task-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* Countdown timer */
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
  margin-top: 6px;
}

.countdown.normal {
  background: #fef3c7;
  color: var(--warning);
}

.countdown.overdue {
  background: var(--error-light);
  color: var(--error);
  animation: countPulse 1s infinite;
}

@keyframes countPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.task-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-time {
  font-size: 12px;
  color: var(--muted);
}

.task-time.overdue {
  color: var(--error);
  font-weight: 500;
}

.task-actions {
  display: flex;
  gap: 8px;
}

/* Action Buttons */
.action-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(166, 75, 42, 0.3);
  min-width: 90px;
  text-align: center;
}

.action-btn.primary:hover {
  background: var(--primary-dark);
}

.action-btn.secondary {
  background: var(--bg);
  color: var(--ink);
}

.action-btn.success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 14px rgba(31, 122, 79, 0.3);
  min-width: 90px;
  text-align: center;
}

.action-btn.danger {
  background: var(--error);
  color: white;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.24);
}

/* Swipe hint */
.swipe-hint {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.swipe-arrow {
  display: inline-block;
  animation: swipeHint 2s infinite;
}

@keyframes swipeHint {
  0%, 100% { transform: translateX(0); opacity: 0.4; }
  50% { transform: translateX(8px); opacity: 1; }
}

/* ===== Modal / Overlay ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 430px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 0 auto 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.modal-textarea:focus {
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions .action-btn {
  flex: 1;
  padding: 14px;
  font-size: 15px;
}

.detail-sheet-content {
  display: grid;
  gap: 10px;
}

.detail-row {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.detail-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.detail-value {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}

/* ===== Rating Stars ===== */
.rating-section {
  text-align: center;
  margin: 16px 0;
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rating-star {
  font-size: 36px;
  cursor: pointer;
  transition: transform 0.2s;
  filter: grayscale(100%);
  opacity: 0.4;
}

.rating-star.active {
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1.1);
}

.rating-label {
  font-size: 14px;
  color: var(--muted);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.empty-state h3 {
  font-size: 16px;
  color: var(--muted);
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-around;
  max-width: 430px;
  margin: 0 auto;
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 16px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  position: relative;
  transition: color 0.2s;
}

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

.nav-icon {
  font-size: 22px;
}

.nav-badge {
  position: absolute;
  top: -2px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--error);
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--ink);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  max-width: 300px;
  text-align: center;
}

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

/* ===== Loading States ===== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ===== Error State ===== */
.error-state {
  text-align: center;
  padding: 40px 20px;
}

.error-state p {
  color: var(--error);
  margin-bottom: 16px;
}

.retry-btn {
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== Legacy Staff Task Card (for backward compatibility) ===== */
.staff-task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.staff-task-card:active {
  transform: scale(0.98);
}

.staff-task-card.urgent {
  border-color: var(--error);
  background: linear-gradient(135deg, var(--surface) 0%, var(--error-light) 100%);
}

.staff-task-card.timeout,
.staff-task-card.escalated {
  border-color: var(--error);
  background: var(--error-light);
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-room-time {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.room-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
}

.task-content {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-type {
  font-size: 12px;
  color: var(--muted);
}

.urgent-badge {
  padding: 2px 8px;
  background: var(--error);
  color: white;
  font-size: 11px;
  border-radius: 10px;
}

.task-action-hint {
  flex-shrink: 0;
}

.action-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.action-badge.accept {
  background: var(--success);
  color: white;
}

.action-badge.processing {
  background: #dbeafe;
  color: #1e40af;
}

/* ===== Legacy Modal Styles ===== */
.staff-modal .modal-content {
  max-width: 360px;
  text-align: left;
  padding: 0;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-detail-body {
  padding: 20px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.detail-label {
  font-size: 14px;
  color: var(--muted);
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
}

.detail-value.room {
  padding: 4px 10px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
}

.detail-value.urgent {
  color: var(--error);
}

.detail-value.high {
  color: var(--warning);
}

.detail-value.normal {
  color: var(--success);
}

.detail-content {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-content .detail-label {
  display: block;
  margin-bottom: 8px;
}

.content-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
}

/* ===== Refresh Button (legacy) ===== */
.refresh-btn {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

/* 智能分诊标签样式 */
.staff-triage {
  background: var(--success-light);
  border-left: 3px solid var(--success);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 10px 0;
}

.staff-triage-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  display: block;
  margin-bottom: 4px;
}

.staff-triage-summary {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}
