:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --primary: #FF6B8A;
  --primary-light: #FFE4E9;
  --bg: #FFF5F5;
  --text: #2D2D2D;
  --text-secondary: #8E8E93;
  --card-bg: #FFFFFF;
  --border: #E8E8E8;
  --input-bg: #FAFAFA;
  --divider: #F0F0F0;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(255, 107, 138, 0.08);
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --tab-height: 52px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --primary: #FF8FA5;
  --primary-light: #3D2630;
  --bg: #121212;
  --text: #E8E8E8;
  --text-secondary: #9E9E9E;
  --card-bg: #1E1E1E;
  --border: #333333;
  --input-bg: #262626;
  --divider: #2A2A2A;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  --success: #66BB6A;
  --warning: #FFA726;
  --danger: #EF5350;
  color-scheme: dark;
}

/* ===== 禁用 iOS 左滑返回：屏幕左侧 15px 透明拦截层 ===== */
#edgeBlockLeft {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 15px;
  z-index: 99999;
  background: transparent;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ===== 修复横向溢出 ===== */
html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  overscroll-behavior-x: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  transition: background-color 0.3s, color 0.3s;
  position: relative;
}

#app {
  min-height: calc(100vh - var(--tab-height) - var(--safe-bottom) - var(--safe-top));
  min-height: calc(100dvh - var(--tab-height) - var(--safe-bottom) - var(--safe-top));
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--primary-light);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  transition: background-color 0.3s, opacity 0.25s ease;
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.tab-item {
  flex: 1;
  height: var(--tab-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 0 2px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  transition: color 0.2s;
}
.tab-item.active { color: var(--primary); }
.tab-icon {
  font-size: 0;
  line-height: 1;
  margin-bottom: 3px;
  display: block;
  height: 22px;
}
.tab-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto;
  overflow: visible;
}

.page {
  padding: 16px;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-top: 8px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: background-color 0.3s;
  overflow: hidden;
}

.loading { text-align: center; padding: 40px; color: var(--text-secondary); }
.empty { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-textarea {
  border-color: var(--border);
  background: var(--input-bg);
  color: var(--text);
}
html[data-theme="dark"] .form-input::placeholder,
html[data-theme="dark"] .form-textarea::placeholder {
  color: #666;
}
html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .form-textarea:focus {
  background: var(--input-bg);
  border-color: var(--primary);
}
html[data-theme="dark"] .form-input[readonly] {
  background: var(--input-bg) !important;
}

html[data-theme="dark"] .status-published { background: #1A2A3A; color: #64B5F6; }
html[data-theme="dark"] .status-assigned { background: #3A2A1A; color: #FFB74D; }
html[data-theme="dark"] .status-completed { background: #1A3A1A; color: #81C784; }
html[data-theme="dark"] .status-cancelled { background: #3A1A1A; color: #E57373; }

html[data-theme="dark"] .timeline-line { background: var(--divider); }

/* ===== 隐藏滚动条（保留滚动功能）===== */
html,
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}