/* ===== 小智|日报管理 — WPS dbsheet 公共样式 ===== */

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: var(--font);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

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

input, textarea, select, button {
  font-family: var(--font);
  font-size: var(--fs-body);
  outline: none;
  border: none;
}

/* ===== 页面容器 ===== */
.page {
  display: none;
  min-height: 100vh;
  padding-bottom: var(--safe-bottom);
  padding-top: var(--safe-top);
}
.page.active {
  display: block;
}

/* ===== WPS dbsheet Header — 纯色 #1677ff ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary); /* 纯色，无渐变 */
  color: #fff;
  padding: 0 var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  /* 无阴影或极轻 */
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.header-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}
.header-back:active {
  background: rgba(255,255,255,0.15);
}
.header-title {
  font-size: var(--fs-title);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 用户头像 + 退出 */
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  cursor: pointer;
  font-size: var(--fs-caption);
}
.header-user-btn:active {
  background: rgba(255,255,255,0.25);
}
.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.header-logout {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.8);
  font-size: var(--fs-caption);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.header-logout:active {
  background: rgba(255,255,255,0.12);
}

/* ===== WPS dbsheet 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

/* ===== WPS dbsheet 按钮 — 4px 圆角 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px; /* 移动端触摸目标 >= 44px */
  padding: 0 var(--spacing-xl);
  border-radius: var(--radius-sm); /* 4px 方正商务 */
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  letter-spacing: 0.5px;
}
.btn:active {
  opacity: 0.85;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active {
  background: var(--primary-active);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:active {
  background: var(--primary-bg);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:active {
  background: var(--bg);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  height: 36px;
  padding: 0 var(--spacing-md);
  font-size: var(--fs-caption);
}
.btn-lg {
  height: 48px;
  font-size: var(--fs-title);
}

/* ===== WPS dbsheet 输入框 ===== */
.form-group {
  margin-bottom: var(--spacing-lg);
}
.form-label {
  display: block;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}
.form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--card);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.form-input::placeholder {
  color: var(--text-light);
}
.form-input.error {
  border-color: var(--danger);
}
.form-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--card);
  resize: vertical;
  transition: border-color 0.2s;
  line-height: 1.6;
}
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.form-textarea::placeholder {
  color: var(--text-light);
}
.form-select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--card);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  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 d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.form-row {
  display: flex;
  gap: 12px;
}
.form-row > * {
  flex: 1;
}
.form-error {
  font-size: var(--fs-caption);
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

/* ===== WPS dbsheet 标签/Tag — 纯色块 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  border: none;
}
.tag-primary {
  background: var(--primary-bg);
  color: var(--primary);
}
.tag-success {
  background: var(--success-bg);
  color: var(--success);
}
.tag-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.tag-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.tag-default {
  background: var(--bg);
  color: var(--text-secondary);
}

/* 状态标签 — WPS 风格色块 */
.tag-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: none;
}
.tag-status.进行中 {
  background: var(--primary-bg);
  color: var(--primary);
}
.tag-status.待启动 {
  background: var(--warning-bg);
  color: var(--warning);
}
.tag-status.待验收 {
  background: var(--success-bg);
  color: var(--success);
}
.tag-status.已完工 {
  background: var(--bg);
  color: var(--text-secondary);
}

/* ===== Loading 状态 ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: var(--fs-body);
  color: var(--text-light);
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 60px;
  color: var(--text-light);
}
.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
  line-height: 1;
}
.empty-title {
  font-size: var(--fs-title);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}
.empty-desc {
  font-size: var(--fs-body);
  color: var(--text-light);
  text-align: center;
  line-height: 1.6;
  max-width: 280px;
}
.empty-action {
  margin-top: var(--spacing-xxl);
}

/* ===== Toast 轻提示 ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  z-index: 9999;
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
  max-width: 80vw;
  text-align: center;
  line-height: 1.5;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== 底部安全区 ===== */
.safe-bottom {
  height: var(--safe-bottom);
}

/* ===== 分隔线 ===== */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--spacing-lg) 0;
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-sm { font-size: var(--fs-caption); }
.text-body { font-size: var(--fs-body); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.flex { display: flex; }
.flex-center { align-items: center; }
.flex-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
