/* ============================================
   协创农业综合管理系统 - 全局样式
   小龙虾·总控专属主题
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #c0392b;
  --primary-dark: #96281b;
  --primary-light: #e74c3c;
  --accent: #e67e22;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #2980b9;
  --bg: #f0f2f5;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #e0e0e0;
  --sidebar-active: #c0392b;
  --card-bg: #ffffff;
  --border: #e8e8e8;
  --text: #2c3e50;
  --text-muted: #7f8c8d;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 24px rgba(0,0,0,.12);
  --radius: 10px;
  --sidebar-w: 220px;
}

body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background: var(--bg); color: var(--text); }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-box {
  background: white; border-radius: 16px; padding: 48px 40px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); text-align: center;
}
.login-logo { font-size: 64px; margin-bottom: 12px; }
.login-box h1 { font-size: 20px; color: var(--text); margin-bottom: 6px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.login-box .form-group { margin-bottom: 14px; }
.login-box input {
  width: 100%; border: 2px solid var(--border); border-radius: 8px;
  padding: 12px 16px; font-size: 14px; transition: border-color .2s;
}
.login-box input:focus { border-color: var(--primary); outline: none; }
.btn-full { width: 100%; margin-top: 8px; }
.login-err { color: var(--danger); margin-top: 12px; font-size: 13px; min-height: 20px; }

/* ===== 布局 ===== */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform .3s; overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.logo-icon { font-size: 28px; }
.logo-text { font-size: 16px; font-weight: bold; color: white; }

.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section {
  font-size: 11px; color: rgba(255,255,255,.4); padding: 12px 20px 4px;
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  cursor: pointer; transition: background .15s; font-size: 14px; color: var(--sidebar-text);
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: var(--sidebar-active); color: white; font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-user {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px; color: rgba(255,255,255,.6); display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
}
.btn-logout {
  background: rgba(255,255,255,.1); border: none; color: rgba(255,255,255,.7);
  padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.btn-logout:hover { background: var(--primary); color: white; }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 56px; background: white; display: flex; align-items: center; padding: 0 24px;
  gap: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); display: none; }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-muted); }

.page-content { padding: 24px; flex: 1; }

/* ===== 卡片/容器 ===== */
.card {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-card.red { border-top: 4px solid var(--primary); }
.stat-card.orange { border-top: 4px solid var(--accent); }
.stat-card.green { border-top: 4px solid var(--success); }
.stat-card.blue { border-top: 4px solid var(--info); }
.stat-card.yellow { border-top: 4px solid var(--warning); }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 6px; border: none; cursor: pointer; font-size: 13px;
  font-weight: 500; transition: all .15s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1e8449; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-secondary { background: #ecf0f1; color: var(--text); }
.btn-secondary:hover { background: #dfe6e9; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 4px; }
.btn-icon { padding: 6px 8px; }

/* ===== 工具栏 ===== */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 12px;
  font-size: 13px; min-width: 180px; outline: none;
}
.search-input:focus { border-color: var(--primary); }
select.filter-select {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px;
  font-size: 13px; outline: none; background: white; cursor: pointer;
}
select.filter-select:focus { border-color: var(--primary); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #f8f9fa; padding: 10px 12px; text-align: left; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

/* ===== 徽标/状态 ===== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-success { background: #d5f5e3; color: #1e8449; }
.badge-warning { background: #fef9e7; color: #d68910; }
.badge-danger { background: #fadbd8; color: #c0392b; }
.badge-info { background: #d6eaf8; color: #1f618d; }
.badge-secondary { background: #ecf0f1; color: #7f8c8d; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px;
  font-size: 13px; outline: none; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  display: none;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: white; border-radius: 12px; width: 100%; max-width: 600px;
  max-height: 85vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 600; flex-shrink: 0;
}
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-close:hover { color: var(--primary); }
#modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-lg .modal-box { max-width: 900px; }

/* ===== Toast ===== */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: 8px; color: white; font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); animation: slideIn .3s ease;
  min-width: 200px; max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 12px; }
.page-btn {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer; font-size: 13px; background: white;
}
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:hover:not(.active) { background: var(--bg); }
.page-info { font-size: 13px; color: var(--text-muted); }

/* ===== 上传按钮 ===== */
.upload-btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
.upload-btn:hover { background: var(--primary-dark); }

/* ===== 统计条 ===== */
.stats-bar { display: flex; gap: 12px; margin-bottom: 20px; }
.stat-card {
  flex: 1;
  background: white;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 28px; font-weight: bold; color: var(--primary); }
.stat-card .desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== 看板格子（总控） ===== */
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }
@media (max-width: 1200px) { .dashboard-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block !important; }
}

/* ===== 角色徽标 ===== */
.role-badge { padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.role-admin { background: #fde8d8; color: #c0392b; }
.role-staff { background: #d5f5e3; color: #1e8449; }
.role-driver { background: #d6eaf8; color: #1f618d; }
.role-safety { background: #fef9e7; color: #b7950b; }

/* ===== 预警行 ===== */
tr.row-danger td { background: #fff5f5; }
tr.row-warning td { background: #fffbf0; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== 分隔线标题 ===== */
.section-title {
  font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; margin: 16px 0 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ===== 进度条 ===== */
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 4px 0; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.progress-green { background: var(--success); }
.progress-orange { background: var(--accent); }
.progress-red { background: var(--danger); }

/* ===== 快速操作面板 ===== */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 12px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 10px; background: white; border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: all .15s; text-align: center; font-size: 13px;
}
.quick-btn:hover { border-color: var(--primary); background: #fff5f4; }
.quick-btn .qi { font-size: 28px; }

.time-display { font-size: 12px; font-family: monospace; }

/* ===== admin-only隐藏逻辑（JS控制） ===== */
.admin-only { display: none; }
.is-admin .admin-only { display: flex !important; }
.is-admin .nav-section.admin-only { display: block !important; }

/* ===== safety角色菜单隐藏逻辑 ===== */
/* safety角色登录时：隐藏总控面板、饲料相关、non-safety标记的菜单项 */
.is-safety .nav-item[data-page="dashboard"],
.is-safety .nav-section:first-of-type,
.is-safety .non-safety { display: none !important; }
/* safety角色不显示admin-only的内容 */
.is-safety .admin-only { display: none !important; }

/* ===== 附件上传按钮 ===== */
.upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; background: #f0f2f5; border: 2px dashed #d0d0d0;
  border-radius: 8px; cursor: pointer; font-size: 13px; color: #555;
  transition: all .15s;
}
.upload-btn:hover { background: #e8f4ff; border-color: var(--info); color: var(--info); }

/* ===== Section标题 ===== */
.section-title {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  margin: 12px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 0; color: #bbb;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== 分页 ===== */
.pager { padding: 12px 0; }
.pager-btns { display: flex; align-items: center; gap: 10px; }
.pager-info { font-size: 13px; color: var(--text-muted); }

/* ===== 权限矩阵表格 ===== */
.data-table th, .data-table td { white-space: nowrap; }

  
\"/* ͼƬԤ */\"  
\".img-preview { margin-top:8px; }\"  
\".img-preview img { border:1px solid #ddd; }\" 
  
\"/* ļϴʽ */\"  
\"input[type=file] { padding: 8px; background: #f5f5f5; border: 1px dashed #ccc; border-radius: 4px; width: 100%; box-sizing: border-box; }\" 
