/* ============================================================
   工单管理系统 - 全局样式
   风格：主流后台管理系统风格，树状结构，浅色主题
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --text-main: #1f2937;
  --text-sub: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 220px;
  --header-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============ 通用按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s ease;
  white-space: nowrap; line-height: 1.4;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text-main); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-page); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

/* ============ 图标按钮 ============ */
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 18px; color: var(--text-sub); transition: all .15s;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--text-main); }

/* ============ 表单元素 ============ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-main);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-label .optional { color: var(--text-light); font-weight: 400; font-size: 12px; }

.form-control, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text-main);
  background: #fff; transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
.form-control::placeholder, .form-textarea::placeholder { color: var(--text-light); }

.input-wrap { position: relative; }
.input-wrap > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 16px; }
.input-wrap > i + input, .input-wrap > i + select { padding-left: 38px; }
.input-wrap .eye-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 16px; padding: 4px; }

/* 定位信息区（经纬度 + 腾讯地图） */
.loc-row { margin-top: 4px; line-height: 1.7; font-size: 13px; }
.loc-map { margin-top: 8px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #f3f4f6; }
.loc-map img { display: block; width: 100%; height: auto; }
.loc-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: #2563eb; font-size: 13px; text-decoration: none;
  padding: 6px 10px; background: #eff6ff; border-radius: 6px;
}
.loc-link:hover { background: #dbeafe; }

/* 地图服务商切换（腾讯 / 高德 / 百度） */
.map-provider-picker { display: inline-flex; gap: 4px; }
.mp-btn {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text-light);
  transition: all .15s; line-height: 1.6; white-space: nowrap;
}
.mp-btn:hover { border-color: #2563eb; color: #2563eb; }
.mp-btn.active {
  background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600;
}

/* 复选框和单选按钮组 */
.check-group, .radio-group { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 0; }
.check-item, .radio-item { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.check-item input[type="checkbox"], .radio-item input[type="radio"] {
  width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer;
}

/* ============ 卡片 ============ */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ============ 登录页 ============ */
#page-login { position: fixed; inset: 0; z-index: 100; }
.login-bg {
  height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #2563eb 50%, #1d4ed8 100%);
  position: relative; overflow: hidden;
}
.login-bg::before, .login-bg::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.login-bg::before { width: 400px; height: 400px; top: -120px; right: -100px; }
.login-bg::after { width: 300px; height: 300px; bottom: -100px; left: -80px; }
.login-card {
  position: relative; z-index: 2; width: 100%; max-width: 400px;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 30px; box-shadow: 0 8px 20px rgba(37,99,235,.35);
}
.login-logo h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-logo p { font-size: 12px; color: var(--text-light); letter-spacing: 1px; }
.login-card .btn-block { padding: 11px; font-size: 16px; border-radius: 8px; margin-top: 6px; }
.login-error { color: var(--danger); font-size: 13px; text-align: center; margin-bottom: 10px; min-height: 18px; }
.login-hint { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 16px; line-height: 1.8; }
.login-hint .qr-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.login-hint .qr-link:hover { text-decoration: underline; }
.login-footer { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ============ 主应用布局 ============ */
#page-app { height: 100vh; display: flex; flex-direction: column; }
.app-header {
  height: var(--header-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.app-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.app-title i { color: var(--primary); font-size: 20px; }
.header-right { display: flex; align-items: center; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 20px; background: var(--bg-page); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.role-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--primary-light); color: var(--primary); font-weight: 600; }
.role-tag.filler { background: var(--success-light); color: var(--success); }

/* 侧边栏 */
.app-body { display: flex; flex: 1; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: margin-left .25s ease; flex-shrink: 0;
}
.side-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 8px; color: var(--text-sub); text-decoration: none;
  font-size: 14px; font-weight: 500; margin-bottom: 2px; transition: all .15s;
  cursor: pointer;
}
.nav-item i { font-size: 18px; width: 20px; text-align: center; }
.nav-item:hover { background: var(--bg-page); color: var(--text-main); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }

/* 主内容 */
.main-content { flex: 1; overflow-y: auto; padding: 20px; }
.content-page { display: none; }
.content-page.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 移动端底部导航 */
.mobile-bottom-nav { display: none; }

/* ============ 工作台 ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-info .num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-info .label { font-size: 13px; color: var(--text-sub); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dashboard-grid .card { min-height: 200px; }
.dash-list { padding: 8px 0; }
.dash-list-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item .d-title { font-weight: 500; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-list-item .d-date { font-size: 12px; color: var(--text-light); }

/* ============ 工单表单 ============ */
.wo-form-section { margin-bottom: 16px; }
.section-title {
  font-size: 15px; font-weight: 700; color: var(--text-main);
  padding: 10px 0; margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
  border-bottom: 2px solid var(--primary-light);
}
.section-title .sec-num {
  width: 24px; height: 24px; border-radius: 6px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.section-title i { color: var(--primary); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* 工单记录卡片 */
.wo-record-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px; overflow: hidden;
}
.wo-record-header {
  padding: 14px 18px; background: var(--primary-light); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wo-record-header .rec-title { font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.wo-record-header .rec-title .rec-badge {
  background: var(--primary); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px;
}
.wo-record-header .rec-actions { display: flex; gap: 6px; }
.wo-record-body { padding: 18px; }

/* 展开/收起 */
.collapse-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 10px; overflow: hidden; }
.collapse-header {
  padding: 11px 14px; background: var(--bg-page); cursor: pointer; display: flex;
  align-items: center; justify-content: space-between; font-weight: 600; font-size: 14px;
  user-select: none; transition: background .15s;
}
.collapse-header:hover { background: #e9ecef; }
.collapse-header .collapse-icon { transition: transform .2s; color: var(--text-sub); }
.collapse-item.open .collapse-icon { transform: rotate(90deg); }
.collapse-body { padding: 14px; border-top: 1px solid var(--border); display: none; }
.collapse-item.open .collapse-body { display: block; }

/* 零件明细表格 */
.parts-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.parts-table th, .parts-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; font-size: 13px; }
.parts-table th { background: var(--bg-page); font-weight: 600; }
.parts-table input, .parts-table select { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.parts-table .row-del { color: var(--danger); background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px; }
.add-row-btn { color: var(--primary); background: none; border: 1px dashed var(--primary); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }

/* 工时记录表格 */
.hours-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.hours-table th, .hours-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; font-size: 13px; }
.hours-table th { background: var(--bg-page); font-weight: 600; }
.hours-table input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
/* 离开工地时间支持选择日期+时间，输入框需要更宽以完整显示日期 */
.hours-table input[type="datetime-local"] { min-width: 178px; }

/* 照片上传 */
.photo-upload { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: all .2s; }
.photo-upload:hover { border-color: var(--primary); background: var(--primary-light); }
.photo-upload i { font-size: 36px; color: var(--text-light); }
.photo-upload p { color: var(--text-sub); margin-top: 6px; }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.photo-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 1; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.photo-item .photo-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; }

/* 签名区域 */
.sign-box { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 14px; }
.sign-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.sign-item { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: #fff; }
.sign-item img { height: 60px; max-width: 180px; }
.sign-item .sign-del { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; cursor: pointer; }
.sign-add-btn { border: 2px dashed var(--primary); color: var(--primary); background: var(--primary-light); padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

/* ============ 工单列表 ============ */
.filter-bar { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-group label { font-size: 12px; color: var(--text-sub); margin-bottom: 4px; display: block; }
.filter-bar .form-control, .filter-bar .form-select { padding: 7px 10px; min-width: 130px; }
.filter-bar .btn { padding: 7px 14px; }

.wo-table-wrap { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.wo-table { width: 100%; border-collapse: collapse; }
.wo-table thead th { background: var(--bg-page); padding: 12px 14px; font-size: 13px; font-weight: 600; text-align: left; color: var(--text-sub); border-bottom: 1px solid var(--border); white-space: nowrap; }
.wo-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.wo-table tbody tr:hover { background: #fafafa; }
.wo-table tbody tr:last-child td { border-bottom: none; }
.status-badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; display: inline-block; }
.status-submitted { background: var(--success-light); color: var(--success); }
.status-draft { background: var(--warning-light); color: var(--warning); }
.status-review { background: var(--primary-light); color: var(--primary); }

.table-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.action-btn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-sub); transition: all .15s; }
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.view:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.download:hover { border-color: var(--success); color: var(--success); }
.action-btn.edit:hover { border-color: var(--warning); color: var(--warning); }
.action-btn.delete:hover { border-color: var(--danger); color: var(--danger); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; }
.page-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-sub); }

/* ============ 用户管理 ============ */
.user-table { width: 100%; border-collapse: collapse; }
.user-table thead th { background: var(--bg-page); padding: 12px 14px; font-size: 13px; font-weight: 600; text-align: left; color: var(--text-sub); border-bottom: 1px solid var(--border); }
.user-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.user-table tbody tr:hover { background: #fafafa; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; margin-right: 8px; vertical-align: middle; }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-box { position: relative; z-index: 2; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-light); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; }

.sign-modal .modal-box { max-width: 960px; }
.sign-modal canvas { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; cursor: crosshair; touch-action: none; display: block; }
.sign-toolbar { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.sign-preset { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.sign-preset-title { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.sign-preset-list { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-item { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; cursor: pointer; background: #fff; }
.preset-item img { height: 30px; }
.preset-item:hover { border-color: var(--primary); }

.image-modal .modal-box { max-width: 900px; background: #000; border-radius: var(--radius); }
.image-modal img { width: 100%; display: block; max-height: 80vh; object-fit: contain; }
.image-modal .modal-close { position: absolute; top: 10px; right: 10px; color: #fff; background: rgba(0,0,0,.5); border-radius: 50%; z-index: 3; }

.confirm-modal .modal-box { max-width: 400px; text-align: center; padding: 28px 24px; }
.confirm-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: var(--danger-light); color: var(--danger); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.confirm-modal h3 { font-size: 17px; margin-bottom: 8px; }
.confirm-modal p { color: var(--text-sub); font-size: 14px; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-actions .btn { min-width: 90px; }

/* ============ Toast ============ */
#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: toastIn .3s ease; max-width: 90vw; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ============ 详情/预览弹窗 ============ */
.wo-detail-box .modal-box { max-width: 900px; }
.wo-detail-body { padding: 20px; }
.detail-record { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 16px; overflow: hidden; }
.detail-record-title { padding: 10px 14px; background: var(--primary-light); font-weight: 600; color: var(--primary); border-bottom: 1px solid var(--border); }
.detail-record-grid { padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.detail-record-grid .full { grid-column: 1/-1; }
.detail-field { font-size: 13px; }
.detail-field .d-label { color: var(--text-light); font-size: 12px; margin-bottom: 2px; }
.detail-field .d-value { font-weight: 500; word-break: break-word; }
.detail-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.detail-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: pointer; }
.detail-signs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.detail-signs .sign-item { text-align: center; }
.detail-signs .sign-item img { height: 50px; }
.comment-box { border-top: 1px solid var(--border); padding: 14px 20px; }

/* ============ 评论 ============ */
.comments-list { margin-bottom: 12px; }
.comment-item { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.comment-meta .c-name { font-weight: 600; color: var(--text-main); }
.comment-content { background: var(--bg-page); padding: 8px 12px; border-radius: 8px; font-size: 14px; line-height: 1.5; }
.comment-input-row { display: flex; gap: 8px; }
.comment-input-row .form-control { flex: 1; }

/* ============ 打印样式 ============ */
#print-area { display: none; }
@media print {
  #page-app, #page-login, .modal, #toast-container { display: none !important; }
  #print-area { display: block !important; }
}

/* ============ 响应式 - 平板 ============ */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ============ 响应式 - 手机 ============ */
@media (max-width: 900px) {
  :root { --header-h: 52px; }
  .app-body { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; top: var(--header-h); bottom: 0; z-index: 40;
    width: 240px; margin-left: -100%; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { margin-left: 0; }
  .side-nav { padding-bottom: 70px; }
  .mobile-bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: #fff; border-top: 1px solid var(--border);
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav .nav-item {
    flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px;
    font-size: 11px; margin: 0;
  }
  .mobile-bottom-nav .nav-item i { font-size: 20px; }
  .main-content { padding: 14px 14px calc(70px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; }
  .detail-record-grid { grid-template-columns: 1fr; }
  .user-chip span { display: none; }
  .user-chip .role-tag { display: none; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 20px; }
  .stat-info .num { font-size: 20px; }
  .filter-bar { padding: 12px 14px; gap: 10px; }
  .filter-bar .form-group { flex: 1 1 45%; }
  .filter-bar .form-control, .filter-bar .form-select { min-width: 100%; }
  .wo-table-wrap { overflow-x: auto; }
  .wo-table { min-width: 700px; }
  .wo-record-body { padding: 14px; }
  .form-group { margin-bottom: 14px; }

  /* ===== 手机端：零件明细卡片化 ===== */
  .parts-table, .parts-table tbody, .parts-table tr, .parts-table td { display: block; width: 100%; }
  .parts-table thead { display: none; }
  .parts-table tbody { margin: 0; }
  .parts-table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
  }
  .parts-table td { border: none; padding: 6px 0; }
  .parts-table td::before {
    display: block; font-size: 12px; color: var(--text-sub);
    margin-bottom: 4px; font-weight: 500;
  }
  .parts-table td:nth-child(1)::before { content: '零件名称'; }
  .parts-table td:nth-child(2)::before { content: '零件编号'; }
  .parts-table td:nth-child(3)::before { content: '单位'; }
  .parts-table td:nth-child(4)::before { content: '数量'; }
  .parts-table td:last-child { text-align: right; }
  .parts-table td:last-child::before { display: none; }
  .parts-table td:last-child .row-del {
    border: 1px solid #fecaca; border-radius: 6px;
    padding: 6px 14px; font-size: 13px; background: #fef2f2;
    display: inline-flex; align-items: center; gap: 4px; color: var(--danger);
  }
  .parts-table input, .parts-table select {
    padding: 10px 10px; font-size: 15px; min-height: 40px;
  }

  /* ===== 手机端：工时记录卡片化 ===== */
  .hours-table, .hours-table tbody, .hours-table tr, .hours-table td { display: block; width: 100%; }
  .hours-table thead { display: none; }
  .hours-table tbody { margin: 0; }
  .hours-table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
  }
  .hours-table td { border: none; padding: 6px 0; }
  .hours-table td::before {
    display: block; font-size: 12px; color: var(--text-sub);
    margin-bottom: 4px; font-weight: 500;
  }
  .hours-table td:nth-child(1)::before { content: '日期'; }
  .hours-table td:nth-child(2)::before { content: '工程师'; }
  .hours-table td:nth-child(3)::before { content: '出发时间'; }
  .hours-table td:nth-child(4)::before { content: '到工地时间'; }
  .hours-table td:nth-child(5)::before { content: '离开工地时间（日期+时间）'; }
  .hours-table td:nth-child(6)::before { content: '实际工时(小时)'; }
  .hours-table input {
    padding: 10px 10px; font-size: 15px; min-height: 40px;
  }

  /* 添加按钮在手机端更大，方便点击 */
  .add-row-btn { padding: 10px 14px; font-size: 14px; width: 100%; }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
