/* ============================================================
   农产品鲜配卡提货系统 - 绿色系主题样式
   桌面 1280px+ 密集表格布局；前台支持手机/平板响应式（≤768px 移动布局）
   ============================================================ */

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

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: #f2f7f2;
  color: #2b3a2e;
  font-size: 14px;
}

/* 后台为桌面密集表格布局，小屏下保持 1280px 宽度（横向滚动查看）；
   前台（body.ffc-mode-front）由底部响应式规则接管，不限最小宽度。
   模式类名由 app.js 在 refresh 时切换。 */
body.ffc-mode-back { min-width: 1280px; }

/* ---------- 顶部栏 ---------- */
.ffc-topbar {
  height: 56px;
  background: linear-gradient(90deg, #1b5e20, #2e7d32);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  position: sticky;
  top: 0;
  z-index: 50;
}

.ffc-brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
}

.ffc-view-switch { display: flex; gap: 8px; }

.ffc-switch-btn {
  padding: 7px 26px;
  border: 1px solid rgba(255, 255, 255, .6);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s;
}
.ffc-switch-btn:hover { background: rgba(255, 255, 255, .18); }
.ffc-switch-btn.active { background: #fff; color: #1b5e20; font-weight: 700; }
.ffc-switch-btn.active:hover { background: #fff; }

/* ---------- 主区域 / 前台页签 ---------- */
/* 底部预留 84px，避免内容被固定客服信息条遮挡 */
.ffc-main { padding: 16px 24px 84px; }

.ffc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #2e7d32;
  margin-bottom: 16px;
}

.ffc-tab {
  padding: 10px 36px;
  background: #e3efe3;
  border: 1px solid #cfe3cf;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 15px;
  color: #3c5140;
}
.ffc-tab:hover { background: #d3e8d3; }
.ffc-tab.active { background: #2e7d32; color: #fff; font-weight: 700; border-color: #2e7d32; }

.ffc-view { min-height: 400px; }

/* ---------- 后台左导航布局 ---------- */
.ffc-back-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.ffc-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.ffc-nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  margin: 2px 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #33463a;
  text-align: left;
}
.ffc-nav-item:hover { background: #eaf4ea; }
.ffc-nav-item.active { background: #2e7d32; color: #fff; font-weight: 700; }

.ffc-page { flex: 1; min-width: 0; }

/* ---------- 面板 ---------- */
.ffc-panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.ffc-panel-title {
  font-size: 16px;
  color: #1b5e20;
  margin-bottom: 12px;
  padding-left: 8px;
  border-left: 4px solid #2e7d32;
  line-height: 1.4;
}

.ffc-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.ffc-panel-head .ffc-panel-title { margin-bottom: 0; }

/* ---------- 表格 ---------- */
.ffc-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}

.ffc-table th {
  background: #e8f1e8;
  color: #1b5e20;
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid #d7e5d7;
  white-space: nowrap;
}

.ffc-table td {
  padding: 7px 10px;
  border: 1px solid #e2ece2;
  vertical-align: top;
}

.ffc-table tbody tr:nth-child(even) { background: #f7fbf7; }
.ffc-table tbody tr:hover { background: #eef6ee; }

.ffc-empty {
  text-align: center;
  color: #88988c;
  padding: 20px 0 !important;
}

.ffc-overdue { color: #c62828; font-weight: 700; }

.ffc-addr {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 表单 ---------- */
.ffc-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.ffc-form-row label,
.ffc-form-col label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #4a5d50;
}

.ffc-form-col { display: flex; flex-direction: column; gap: 12px; }

.ffc-form-row input,
.ffc-form-row select,
.ffc-form-col input,
.ffc-form-col select,
.ffc-textarea,
.ffc-toolbar input,
.ffc-toolbar select {
  padding: 7px 10px;
  border: 1px solid #b9cfb9;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
  color: #2b3a2e;
  min-width: 160px;
  font-family: inherit;
}

.ffc-form-row input:focus,
.ffc-form-row select:focus,
.ffc-form-col input:focus,
.ffc-form-col select:focus,
.ffc-textarea:focus,
.ffc-toolbar input:focus,
.ffc-toolbar select:focus,
.ffc-ship-form input:focus {
  outline: none;
  border-color: #2e7d32;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, .15);
}

.ffc-textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  line-height: 1.6;
}

.ffc-form-actions { display: flex; gap: 8px; }

/* ---------- 发货共用表单 ---------- */
.ffc-ship-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: #f3f9f3;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.ffc-ship-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #4a5d50;
}

.ffc-ship-form input {
  padding: 7px 10px;
  border: 1px solid #b9cfb9;
  border-radius: 4px;
  font-size: 14px;
  min-width: 150px;
  background: #fff;
  font-family: inherit;
}

/* ---------- 按钮 ---------- */
.ffc-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}

.ffc-btn-primary { background: #2e7d32; color: #fff; }
.ffc-btn-primary:hover { background: #1b5e20; }

.ffc-btn-default { background: #fff; border: 1px solid #b9cfb9; color: #33503a; }
.ffc-btn-default:hover { background: #eaf4ea; }

.ffc-btn-danger { background: #c62828; color: #fff; }
.ffc-btn-danger:hover { background: #a01f1f; }

.ffc-link-btn {
  border: none;
  background: transparent;
  color: #1565c0;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
}
.ffc-link-btn:hover { text-decoration: underline; }
.ffc-link-btn.ffc-danger-link { color: #c62828; }

/* ---------- 徽标 / 红点 ---------- */
.ffc-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
}

.ffc-badge-gray   { background: #eceff1; color: #546e7a; }
.ffc-badge-blue   { background: #e3f2fd; color: #1565c0; }
.ffc-badge-green  { background: #e8f5e9; color: #2e7d32; }
.ffc-badge-dark   { background: #37474f; color: #fff; }
.ffc-badge-red    { background: #ffebee; color: #c62828; }
.ffc-badge-orange { background: #fff3e0; color: #e65100; }

.ffc-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 9px;
  background: #e53935;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- 弹窗 ---------- */
.ffc-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

.ffc-modal {
  background: #fff;
  border-radius: 8px;
  width: 540px;
  max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  animation: ffc-modal-in .18s ease;
}

@keyframes ffc-modal-in {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ffc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e0e8e0;
  font-size: 16px;
  font-weight: 700;
  color: #1b5e20;
}

.ffc-modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: #888;
  line-height: 1;
}
.ffc-modal-close:hover { color: #c62828; }

.ffc-modal-body {
  padding: 18px;
  max-height: 60vh;
  overflow: auto;
}

.ffc-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #e0e8e0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ffc-confirm-msg { font-size: 14px; line-height: 1.7; padding: 4px 0; }

/* ---------- 轻提示 ---------- */
.ffc-toast-wrap {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.ffc-toast {
  padding: 10px 22px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
  animation: ffc-toast-in .25s ease;
}

.ffc-toast-success { background: #2e7d32; }
.ffc-toast-error   { background: #c62828; }
.ffc-toast-info    { background: #455a64; }

.ffc-toast-out { opacity: 0; transition: opacity .3s; }

@keyframes ffc-toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 工具条 / 杂项 ---------- */
.ffc-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ffc-flex { flex: 1; }

.ffc-muted { color: #78897c; font-size: 12px; margin: 6px 0; }

.ffc-hidden { display: none !important; }

.ffc-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}

.ffc-card-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 24px;
  background: #f3f9f3;
  border: 1px solid #dfeadf;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}

.ffc-result-card {
  border: 2px solid #2e7d32;
  border-radius: 8px;
  padding: 16px;
  background: #f6fbf6;
  margin-top: 14px;
}

.ffc-result-card h3 { color: #2e7d32; font-size: 20px; margin-bottom: 12px; }

.ffc-stat-row { display: flex; gap: 16px; flex-wrap: wrap; }

.ffc-stat {
  flex: 1;
  min-width: 140px;
  background: #f3f9f3;
  border: 1px solid #dfeadf;
  border-radius: 6px;
  padding: 14px;
  text-align: center;
}

.ffc-stat-num { font-size: 26px; font-weight: 700; color: #2e7d32; }
.ffc-stat-label { font-size: 13px; color: #5d6f61; margin-top: 4px; }

.ffc-import-line { font-size: 13px; padding: 3px 0; line-height: 1.5; }
.ffc-import-ok   { color: #2e7d32; }
.ffc-import-fail { color: #c62828; }

.ffc-file-label { display: inline-flex; align-items: center; }
.ffc-hidden-input { display: none; }

/* ============================================================
   增量开发新增：登录 / 角色 / 用户管理 / 客服信息条
   ============================================================ */

/* ---------- 顶栏用户区 ---------- */
.ffc-topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
}

.ffc-topbar-guest { color: rgba(255, 255, 255, .85); }

.ffc-topbar-user-name { color: #fff; font-weight: 700; }

.ffc-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
}
.ffc-role-admin { background: #fff3e0; color: #e65100; }
.ffc-role-user  { background: #e3f2fd; color: #1565c0; }

.ffc-topbar-btn {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .6);
  background: transparent;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  transition: background .15s;
}
.ffc-topbar-btn:hover { background: rgba(255, 255, 255, .18); }

/* ---------- 登录页 ---------- */
.ffc-login-wrap {
  display: flex;
  justify-content: center;
  padding-top: 48px;
}

.ffc-login-panel { width: 380px; }

.ffc-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ffc-login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #4a5d50;
}

.ffc-login-form input {
  padding: 9px 12px;
  border: 1px solid #b9cfb9;
  border-radius: 4px;
  font-size: 14px;
  min-width: 0;
  background: #fff;
  color: #2b3a2e;
  font-family: inherit;
}
.ffc-login-form input:focus {
  outline: none;
  border-color: #2e7d32;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, .15);
}

.ffc-login-form .ffc-btn { width: 100%; padding: 10px; }

.ffc-login-tip { line-height: 1.7; margin-top: 14px; }

/* ---------- 用户管理 / 客服设置 ---------- */
.ffc-inline-note {
  color: #88988c;
  font-size: 12px;
  margin-left: 4px;
}

.ffc-svc-form label { min-width: 0; }

.ffc-svc-actions { margin-top: 14px; }

/* ---------- 前台客服信息条 ---------- */
.ffc-service-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 10px 24px;
  background: #1b5e20;
  color: #fff;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, .15);
}

.ffc-service-sep { color: #a5d6a7; }

.ffc-service-default { color: #c8e6c9; }

/* 后台设置页的前台效果预览（与真实信息条同色系，内嵌展示） */
.ffc-service-preview {
  padding: 10px 24px;
  background: #1b5e20;
  color: #fff;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
  border-radius: 6px;
}

/* ============================================================
   响应式适配（手机 / 平板 / 计算机）
   - 前台（body.ffc-mode-front）：≤768px 切换移动端布局（页签横排、
     表单纵向堆叠、表格转卡片式、客服条与主区底部留白适配）；
   - 后台：保持桌面 1280px 密集布局（body.ffc-mode-back min-width）；
   - 弹窗 / 轻提示为全局浮层，移动端一律自适应（不受模式影响）。
   ============================================================ */

@media (max-width: 768px) {
  /* ---------- 顶栏（前台/后台共用，移动端自动换行压缩） ---------- */
  .ffc-topbar {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 14px;
  }
  .ffc-brand { font-size: 16px; letter-spacing: 1px; }
  .ffc-view-switch { gap: 6px; }
  .ffc-switch-btn { padding: 6px 14px; font-size: 13px; }
  .ffc-topbar-user { font-size: 12px; flex-wrap: wrap; }
  .ffc-topbar-btn { padding: 5px 10px; font-size: 12px; }

  /* ---------- 前台页签：两个页签等宽横排，方便手指点按 ---------- */
  body.ffc-mode-front .ffc-tab {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    font-size: 14px;
    white-space: nowrap;
  }

  /* ---------- 主区域 / 面板：收窄留白，底部加大避开客服信息条 ---------- */
  body.ffc-mode-front .ffc-main { padding: 12px 12px 118px; }
  body.ffc-mode-front .ffc-panel { padding: 14px 12px; }

  /* ---------- 开卡表单：纵向堆叠，输入项撑满 ---------- */
  body.ffc-mode-front .ffc-form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  body.ffc-mode-front .ffc-form-row label { gap: 5px; }
  body.ffc-mode-front .ffc-form-row input,
  body.ffc-mode-front .ffc-form-row select {
    width: 100%;
    min-width: 0;
    font-size: 16px; /* ≥16px 避免 iOS 聚焦自动放大 */
    padding: 10px 12px;
  }
  body.ffc-mode-front .ffc-form-actions { flex-direction: column; }
  body.ffc-mode-front .ffc-form-actions .ffc-btn {
    width: 100%;
    padding: 11px;
    font-size: 15px;
  }

  /* ---------- 查询工具条：卡号/密码/按钮逐行撑满 ---------- */
  body.ffc-mode-front .ffc-toolbar input {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    font-size: 16px;
    padding: 10px 12px;
  }
  body.ffc-mode-front .ffc-toolbar .ffc-btn {
    flex: 1 1 100%;
    padding: 11px;
    font-size: 15px;
  }

  /* ---------- 卡信息 / 开卡结果卡 ---------- */
  body.ffc-mode-front .ffc-card-info { grid-template-columns: 1fr; gap: 4px 0; }
  body.ffc-mode-front .ffc-result-card { padding: 14px 12px; }
  body.ffc-mode-front .ffc-result-card h3 { font-size: 18px; }

  /* ---------- 前台表格：手机端转为「标签-取值」卡片列表 ---------- */
  body.ffc-mode-front .ffc-rwd-table thead { display: none; }
  body.ffc-mode-front .ffc-rwd-table,
  body.ffc-mode-front .ffc-rwd-table tbody { display: block; }
  body.ffc-mode-front .ffc-rwd-table tr {
    display: block;
    background: #fff;
    border: 1px solid #d7e5d7;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 2px 0;
  }
  body.ffc-mode-front .ffc-rwd-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: none;
    border-bottom: 1px dashed #e2ece2;
    padding: 8px 12px;
    text-align: right;
    word-break: break-all;
  }
  body.ffc-mode-front .ffc-rwd-table td:last-child { border-bottom: none; }
  body.ffc-mode-front .ffc-rwd-table td::before {
    content: attr(data-label);
    color: #1b5e20;
    font-weight: 700;
    flex-shrink: 0;
    text-align: left;
  }
  body.ffc-mode-front .ffc-rwd-table td.ffc-empty {
    justify-content: center;
    text-align: center;
  }
  body.ffc-mode-front .ffc-rwd-table td.ffc-empty::before { content: none; }

  /* ---------- 前台客服信息条：小字号多行自适应 ---------- */
  body.ffc-mode-front .ffc-service-bar { padding: 8px 14px; font-size: 12px; }

  /* ---------- 弹窗（全局浮层）：移动端近全屏，按钮等宽 ---------- */
  .ffc-modal-overlay {
    padding-top: 6vh;
    padding-left: 12px;
    padding-right: 12px;
  }
  .ffc-modal { width: 100%; max-width: 100%; }
  .ffc-modal-header { padding: 12px 14px; font-size: 15px; }
  .ffc-modal-body { padding: 14px; max-height: 66vh; }
  .ffc-modal-footer { padding: 10px 14px; flex-wrap: wrap; }
  .ffc-modal-footer .ffc-btn { flex: 1 1 auto; }
  body.ffc-mode-front .ffc-modal-body input {
    width: 100%;
    min-width: 0;
    font-size: 16px;
    padding: 10px 12px;
  }

  /* ---------- 轻提示 ---------- */
  .ffc-toast { max-width: 86vw; text-align: center; font-size: 13px; }
}

/* 平板 / 中屏（769px ~ 1024px）：前台微调留白与控件宽度 */
@media (min-width: 769px) and (max-width: 1024px) {
  body.ffc-mode-front .ffc-main { padding: 14px 16px 84px; }
  body.ffc-mode-front .ffc-tab { padding: 10px 20px; }
  body.ffc-mode-front .ffc-toolbar input { flex: 1; min-width: 140px; }
  body.ffc-mode-front .ffc-form-row { gap: 10px; }
}

