/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    height: 100%;
    overflow: hidden;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ===== 页面容器 ===== */
.page {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.page.active {
    display: flex;
}
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 100px;
    -webkit-overflow-scrolling: touch;
}

/* ===== 顶部状态栏 ===== */
.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
    padding: 0 4px;
}

/* ===== 页面头部（含返回按钮） ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.page-header .back-btn {
    color: #007AFF;
    font-size: 14px;
    cursor: pointer;
}
.page-header .page-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

/* ===== 用户卡片 ===== */
.user-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    color: white;
    margin-bottom: 16px;
}
.user-card.center {
    text-align: center;
}
.user-avatar {
    font-size: 36px;
    margin-bottom: 8px;
}
.user-name {
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 5px;
}
.user-unit {
    font-size: 13px;
    opacity: 0.9;
}

/* ===== 分区标题 ===== */
.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 16px 0 10px;
}

/* ===== 大按钮 ===== */
.button-large {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #007AFF 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: opacity 0.2s;
}
.button-large:active { opacity: 0.85; }
.button-large.success {
    background: linear-gradient(135deg, #52C41A 0%, #389E0D 100%);
}
.button-large.danger {
    background: linear-gradient(135deg, #FF4D4F 0%, #D9363E 100%);
}

/* ===== 小按钮 ===== */
.btn-small {
    padding: 6px 14px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}
.btn-outline {
    width: 100%;
    padding: 10px;
    background: #fff;
    color: #007AFF;
    border: 1px solid #007AFF;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
}
.btn-primary {
    padding: 8px 16px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
}
.btn-secondary {
    padding: 8px 16px;
    background: #E0E0E0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
}

/* ===== 卡片 ===== */
.card {
    background: white;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

/* ===== 库存进度条 ===== */
.inventory-item {
    background: white;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.inventory-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}
.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-fill.warning { background: #FF9800; }

/* ===== 位置卡片 ===== */
.location-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
}
.location-text {
    font-size: 14px;
    color: #333;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
    display: block;
    font-weight: 500;
}
.select-box {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    outline: none;
}
.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}
.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.input-row .form-input {
    flex: 1;
}
.input-unit {
    font-size: 14px;
    color: #666;
}

/* ===== 单选组 ===== */
.radio-group {
    display: flex;
    gap: 10px;
}
.radio-label {
    flex: 1;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    font-size: 14px;
    transition: all 0.2s;
}
.radio-label.active {
    background: #E6F7FF;
    border-color: #007AFF;
    color: #007AFF;
    font-weight: 600;
}

/* ===== 标注区域 ===== */
.annotate-card {
    margin-bottom: 16px;
}
.annotate-list {
    margin-top: 10px;
}
.annotate-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.annotate-item:last-child { border-bottom: none; }
.annotate-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}
.annotate-dot.red { background: #FF4D4F; }
.annotate-dot.green { background: #52C41A; }

/* ===== 投放点列表 ===== */
.drop-card {
    margin-bottom: 12px;
}
.drop-card.safe { border-left: 4px solid #52C41A; }
.drop-card.danger { border-left: 4px solid #FF4D4F; background: #FFF3F3; }
.drop-info {
    font-size: 12px;
    color: #666;
    margin: 4px 0 10px;
}
.drop-info span { margin-right: 12px; }
.select-btn {
    width: 100%;
    padding: 10px;
    background: #52C41A;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.avoid-btn {
    width: 100%;
    padding: 10px;
    background: #FF4D4F;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

/* ===== 任务监控 ===== */
.task-card { text-align: center; padding: 18px; }
.task-label { font-size: 13px; color: #666; margin-bottom: 5px; }
.task-id { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.task-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.task-status.running { background: #F6FFED; color: #52C41A; }
.task-eta { font-size: 13px; color: #666; margin-top: 8px; }

.progress-card { text-align: center; padding: 16px; }
.progress-text { font-size: 14px; color: #007AFF; font-weight: 600; margin-bottom: 6px; }
.progress-sub { font-size: 12px; color: #666; }

.path-card {
    background: #E6F7FF;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}
.path-label { font-size: 12px; color: #007AFF; margin-bottom: 4px; }
.path-value { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 12px; }
.path-value:last-child { margin-bottom: 0; }

.drop-zone {
    border: 2px dashed #FF4D4F;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}
.drop-icon { font-size: 28px; margin-bottom: 5px; }
.drop-name { font-weight: 600; color: #FF4D4F; margin-bottom: 6px; }
.risk-score {
    display: inline-block;
    padding: 2px 10px;
    background: #E6F7FF;
    color: #007AFF;
    border-radius: 4px;
    font-size: 12px;
}

.emergency-card { background: #FFF3F3; border: 1px solid #FFCCC7; }
.emergency-title { font-size: 14px; color: #FF4D4F; margin-bottom: 10px; }
.emergency-btns { display: flex; gap: 8px; }

/* ===== 统计列表 ===== */
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: #666; }
.stat-value { font-weight: 600; color: #333; }
.stat-value.danger { color: #FF4D4F; }

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.tag-success { background: #F6FFED; color: #52C41A; }
.tag-danger { background: #FFF3F3; color: #FF4D4F; }

/* ===== 日志时间线 ===== */
.log-row {
    font-size: 13px;
    color: #666;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.log-row:last-child { border-bottom: none; }
.log-time { color: #999; margin-right: 8px; }

/* ===== 地图占位 ===== */
.map-placeholder {
    background: #F0F0F0;
    border: 2px dashed #007AFF;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.map-icon { font-size: 30px; margin-bottom: 5px; }
.map-text { color: #666; font-size: 14px; }

/* ===== 警告卡片 ===== */
.warning-card { background: #FFF7E6; border: 1px solid #FFD591; }
.warning-title { font-size: 13px; color: #FA8C16; margin-bottom: 8px; }
.warning-item { font-size: 12px; color: #666; margin-bottom: 4px; }

/* ===== 按钮行 ===== */
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.flex-1 { flex: 1; }

/* ===== 个人中心统计 ===== */
.stats-grid {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 16px;
}
.stat-box { flex: 1; }
.stat-num {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}
.stat-num.done { color: #52C41A; }
.stat-num.active { color: #1890FF; }
.stat-num.pending { color: #FA8C16; }
.stat-num.cancel { color: #FF4D4F; }

/* ===== 菜单列表 ===== */
.menu-list { padding: 0; }
.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
.menu-item:active { background: #f5f5f5; }
.menu-item:last-child { border-bottom: none; }
.menu-value { color: #666; font-size: 13px; }
.menu-toggle {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #ccc;
    position: relative;
    transition: background 0.2s;
}
.menu-toggle.on { background: #52C41A; }
.menu-toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
}
.menu-toggle.on::after { left: 18px; }

/* ===== SOS卡片 ===== */
.sos-card { background: #FFF3F3; border: 1px solid #FFCCC7; margin-top: 16px; }
.sos-title { font-size: 14px; color: #FF4D4F; margin-bottom: 10px; }

/* ===== 底部Tab导航 ===== */
.tab-bar {
    display: flex;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding-bottom: env(safe-area-inset-bottom);
    flex-shrink: 0;
    z-index: 100;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}
.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}
.tab-item.active { color: #007AFF; }
.tab-icon { font-size: 20px; margin-bottom: 2px; }
.tab-label { font-size: 11px; }

/* ===== Toast提示 ===== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

/* ===== 登录页 ===== */
.login-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-logo {
    font-size: 64px;
    margin-bottom: 16px;
}
.login-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: 2px;
}
.login-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 32px;
}
.login-form {
    width: 100%;
    max-width: 320px;
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}
.login-form .form-group {
    margin-bottom: 16px;
}
.login-form .form-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}
.login-form .form-input {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
}
.login-form .button-large {
    margin-top: 8px;
    margin-bottom: 12px;
}
.login-switch {
    text-align: center;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    padding: 8px;
}
.login-switch:hover {
    color: #007AFF;
}
.login-demo {
    width: 100%;
    max-width: 320px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 14px 18px;
    backdrop-filter: blur(4px);
}
.demo-title {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
    text-align: center;
}
.demo-item {
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
}
.demo-item:last-child { border-bottom: none; }
.demo-item:hover { color: #fff; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 0; }
