/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: #f5f6f8;
  min-height: 100vh;
  color: #333;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ========== 登录页 ========== */
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 40px;
  max-width: 400px;
  margin: 60px auto 0;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header h1 {
  font-size: 22px;
  color: #222;
  margin-bottom: 6px;
  font-weight: 600;
}

.login-header p {
  color: #999;
  font-size: 14px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: #555;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
  background: #fafafa;
}

.form-group input:focus {
  border-color: #4a90d9;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.1);
}

.error-message {
  background: #fff5f5;
  color: #e74c3c;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid #ffe0e0;
}

button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-weight: 500;
}

button:active {
  transform: scale(0.98);
}

button[type="submit"] {
  background: #4a90d9;
  color: #fff;
}

button[type="submit"]:hover {
  background: #357abd;
}

button[type="submit"]:disabled {
  background: #b0c4de;
  cursor: not-allowed;
}

/* ========== 仪表盘 ========== */
.dashboard-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  background: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  margin-right: auto;
  color: #555;
}

.btn-secondary {
  background: #f0f2f5;
  color: #555;
  width: auto;
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 8px;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #e4e6eb;
}

.btn-danger {
  background: #fff0f0;
  color: #e74c3c;
  width: auto;
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 8px;
  white-space: nowrap;
}

.btn-danger:hover {
  background: #ffe0e0;
}

.dashboard-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 24px;
  overflow: hidden;
}

.dashboard-card h2 {
  font-size: 18px;
  color: #222;
  margin-bottom: 4px;
  font-weight: 600;
}

.task-info {
  color: #999;
  font-size: 14px;
  margin-bottom: 18px;
}

.task-info span {
  font-weight: 700;
  color: #4a90d9;
  font-size: 18px;
}

/* ========== 表格 ========== */
#taskContainer {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: #f8f9fb;
  color: #666;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}

tbody tr:hover {
  background: #f8f9fb;
}

tbody tr:last-child td {
  border-bottom: none;
}

.btn-approve {
  background: #27ae60;
  color: #fff;
  width: auto;
  padding: 8px 20px;
  font-size: 14px;
  border-radius: 8px;
  white-space: nowrap;
}

.btn-approve:hover {
  background: #219a52;
}

.btn-approve:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #999;
}

.empty-state p {
  font-size: 15px;
}

/* ========== 加载动画 ========== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 0;
  color: #999;
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #eee;
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== Toast 提示 ========== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1000;
  animation: fadeIn 0.25s ease;
}

.toast.success {
  background: #27ae60;
  color: #fff;
}

.toast.error {
  background: #e74c3c;
  color: #fff;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== 任务详情模态框 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 440px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h3 {
  font-size: 17px;
  color: #222;
}

.modal-close {
  width: 30px;
  height: 30px;
  padding: 0;
  background: #f0f2f5;
  color: #888;
  font-size: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover {
  background: #e0e2e6;
}

.modal-body {
  padding: 20px 24px;
}

.modal-field {
  display: flex;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f0f2f5;
}

.modal-field:last-child {
  border-bottom: none;
}

.modal-field label {
  width: 72px;
  flex-shrink: 0;
  font-size: 14px;
  color: #999;
  font-weight: 500;
}

.modal-field span {
  font-size: 14px;
  color: #333;
  word-break: break-all;
  line-height: 1.5;
}

.modal-footer {
  padding: 0 24px 20px;
  text-align: center;
}

.modal-footer .btn-approve {
  width: 100%;
  padding: 10px;
  font-size: 15px;
}

/* ========== 声明模态框 ========== */
#declarationModal {
  z-index: 3000;
}

#declarationModal .modal-box {
  width: 520px;
  max-width: 92vw;
}

#declarationModal .modal-body {
  padding: 16px 24px;
}

#declarationContent {
  font-size: 14px;
  color: #444;
  line-height: 1.8;
  max-height: 50vh;
  overflow-y: auto;
  padding: 12px 16px;
  background: #fafafa;
  border-radius: 10px;
  white-space: pre-wrap;
}

#declarationConfirmBtn {
  background: #4a90d9;
  color: #fff;
  width: 100%;
  padding: 10px;
  font-size: 15px;
  border-radius: 10px;
}

#declarationConfirmBtn:hover {
  background: #357abd;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .login-card {
    margin: 30px auto 0;
    padding: 28px 24px;
    max-width: 100%;
  }

  .login-header h1 {
    font-size: 20px;
  }

  .dashboard-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
  }

  .dashboard-header .btn-secondary,
  .dashboard-header .btn-danger {
    font-size: 12px;
    padding: 6px 14px;
  }

  .dashboard-card {
    padding: 16px;
    border-radius: 12px;
  }

  .dashboard-card h2 {
    font-size: 16px;
  }

  /* 手机端表格卡片化 */
  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    background: #fafafa;
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid #eee;
    cursor: pointer;
  }

  tbody tr:hover {
    background: #f0f2f5;
  }

  tbody td {
    padding: 6px 0;
    border: none;
    display: flex;
    align-items: center;
  }

  tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #888;
    width: 72px;
    flex-shrink: 0;
    font-size: 13px;
  }

  tbody td:last-child {
    border-bottom: none;
  }

  .modal-box {
    width: 95vw;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-field label {
    width: 64px;
    font-size: 13px;
  }

  .modal-field span {
    font-size: 13px;
  }

  #declarationModal .modal-box {
    width: 95vw;
  }

  #declarationContent {
    font-size: 13px;
    padding: 10px 14px;
    max-height: 40vh;
  }
}