/* 企业开办代办 · 管理台样式 */
:root {
  --brand: #2f6fed;
  --brand-dark: #1f4fc4;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e6ebf3;
  --text: #1f2733;
  --text-2: #5d6b7f;
  --text-3: #93a1b3;
  --warn: #f59e0b;
  --doing: #2f6fed;
  --done: #16a34a;
  --bad: #dc2626;
  --radius: 10px;
}

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

/* 移动端点击不出现灰块、长按不弹菜单 */
* { -webkit-tap-highlight-color: transparent; }

html, body {
  /* 防止 iOS 横屏时字号自动放大 */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2f6fed 0%, #1c3f96 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 30px 30px;
  box-shadow: 0 20px 50px rgba(10, 30, 80, 0.28);
}

.login-logo {
  font-size: 42px;
  text-align: center;
  line-height: 1;
}

.login-title {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  margin-top: 14px;
}

.login-sub {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  margin-top: 6px;
  margin-bottom: 26px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.btn-primary {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.login-msg {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  min-height: 20px;
  color: var(--bad);
}

/* ============ 主框架 ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: #14213d;
  color: #c8d3e6;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 20px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-group-title {
  padding: 16px 18px 7px;
  font-size: 11px;
  letter-spacing: 0.6px;
  color: #6f8099;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  font-size: 13.5px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.05); }
.nav-item.active {
  background: rgba(47, 111, 237, 0.22);
  border-left-color: var(--brand);
  color: #fff;
}

.nav-count {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.13);
  padding: 1px 7px;
  border-radius: 9px;
}

.nav-count.hot { background: var(--bad); color: #fff; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  color: #7d8ea8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-foot a { color: #9fb4d8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title { font-size: 15px; font-weight: 600; }

.search {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.search input {
  width: 230px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  outline: none;
}

.search input:focus { border-color: var(--brand); }

.btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.12s, color 0.12s;
}

.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn-solid {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.btn-solid:hover { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.btn-danger { color: var(--bad); border-color: #f3c9c9; }
.btn-danger:hover { background: #fef2f2; border-color: var(--bad); color: var(--bad); }

.content { padding: 20px 22px 40px; }

/* ============ 列表（桌面表格 / 手机卡片，同一份 DOM） ============ */
.list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

/* 7 列网格：桌面用 */
.list-head,
.row {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1.15fr 0.8fr 1fr 1.15fr;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
}

.list-head {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
}

.row {
  border-bottom: 1px solid #f1f4f9;
  transition: background 0.1s;
  cursor: pointer;
}

.row:hover { background: #f8fafd; }
.row:last-child { border-bottom: none; }

.row .c-name { min-width: 0; }
.row .c-meta { font-size: 12.5px; color: var(--text-2); }
.row .c-time { font-size: 12.5px; color: var(--text-3); }

/* 手机端才显示的字段区（桌面隐藏）。
   注意：必须在这里给默认值，否则媒体查询没命中时它会作为
   普通块级元素渲染，导致桌面端每行数据重复显示一遍。 */
.row .c-fields { display: none; }

.cell-title { font-weight: 500; }
.cell-sub { font-size: 12.5px; color: var(--text-3); }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
}

.tag-warn { background: #fff7e6; color: #b45309; }
.tag-doing { background: #eaf1ff; color: #1d4ed8; }
.tag-done { background: #e8f8ef; color: #15803d; }
.tag-bad { background: #fdecec; color: #b91c1c; }

.tag-miss { background: #fdecec; color: #b91c1c; }
.tag-ok { background: #e8f8ef; color: #15803d; }

.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--text-3);
}

.empty-icon { font-size: 40px; margin-bottom: 10px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
  background: #fff;
}

.pager-btns { display: flex; gap: 8px; align-items: center; }

/* ============ 详情抽屉 ============ */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 44, 0.42);
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}

.drawer-mask.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 94vw);
  background: var(--bg);
  z-index: 61;
  transform: translateX(100%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(10, 25, 55, 0.16);
}

.drawer.open { transform: translateX(0); }

.drawer-head {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.drawer-head h2 { font-size: 17px; font-weight: 600; }
.drawer-close {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-3);
  padding: 0 4px;
}

.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; }

.sec {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

.sec-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-body { padding: 14px 16px; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { color: var(--text); word-break: break-all; }

.member {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 10px;
  background: #fcfdff;
}

.member-head {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip {
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 4px;
  background: #eef2f8;
  color: var(--text-2);
  font-weight: 400;
}

.chip.ok { background: #e8f8ef; color: #15803d; }
.chip.bad { background: #fdecec; color: #b91c1c; }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.thumb {
  width: 92px;
  height: 62px;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #f0f3f8;
  cursor: zoom-in;
}

/* 图片加载失败：显示占位文字，而不是浏览器的破图标 */
.thumb.broken {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f7f9fc;
  border-style: dashed;
  color: var(--text-3);
  font-size: 11.5px;
  cursor: default;
  position: relative;
}

.thumb.broken::after {
  content: '加载失败';
}

.missing-list { display: flex; flex-wrap: wrap; gap: 7px; }

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #eef1f6;
  flex-wrap: wrap;
}

.status-row:last-child { border-bottom: none; }
.status-row .grow { flex: 1; min-width: 130px; }

.status-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.timeline { font-size: 13px; }
.timeline-item {
  padding: 7px 0 7px 15px;
  border-left: 2px solid var(--line);
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}
.timeline-time { color: var(--text-3); font-size: 12px; }

/* ============ 弹窗 / 提示 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 44, 0.45);
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-mask.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  padding: 22px;
}

.modal h3 { font-size: 16px; margin-bottom: 6px; }
.modal p { color: var(--text-2); font-size: 13.5px; margin-bottom: 14px; }

.modal textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}

.modal textarea:focus { border-color: var(--brand); }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -14px);
  background: #1f2733;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 80vw;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b91c1c; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ============================================================
   移动端适配
   断点：
     ≤ 900px  平板竖屏：列表转卡片
     ≤ 560px  手机：进一步压缩间距、抽屉全屏
   ============================================================ */

/* 侧栏遮罩：桌面不显示 */
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 44, 0.45);
  z-index: 45;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}

.sidebar-mask.open { opacity: 1; visibility: visible; }

/* 汉堡按钮：桌面隐藏 */
.icon-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.burger {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  position: relative;
}

.burger::before,
.burger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: var(--text);
}

.burger::before { top: -5px; }
.burger::after { top: 5px; }

/* ---------- ≤ 900px：列表转卡片 ---------- */
@media (max-width: 900px) {
  /* 侧栏变抽屉 */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 46;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(10, 25, 55, 0.2);
    width: 240px;
    flex-basis: 240px;
  }

  .sidebar.open { transform: translateX(0); }

  .icon-btn { display: inline-flex; }

  .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .topbar-title {
    font-size: 14.5px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search {
    margin-left: 0;
    width: 100%;
    order: 3;
  }

  .search input {
    flex: 1;
    width: auto;
    height: 38px;
    /* iOS 上 input 字号 <16px 会触发自动放大 */
    font-size: 16px;
  }

  .search .btn { height: 38px; flex: 0 0 auto; }

  .content { padding: 12px; }

  /* 表头隐藏，每条记录变卡片 */
  .list {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .list-head { display: none; }

  .row {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
  }

  .row:last-child { margin-bottom: 0; }

  .row .c-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    padding-right: 60px;
    margin-bottom: 3px;
  }

  .row .c-name .cell-sub {
    font-size: 12.5px;
    font-weight: 400;
    margin-top: 3px;
  }

  /* 状态标签浮到右上角 */
  .row .c-status {
    position: absolute;
    top: 13px;
    right: 13px;
  }

  /* 其余字段排成两列，带小标签 */
  .row .c-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eef1f6;
  }

  .row .c-field {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    min-width: 0;
  }

  .row .c-field .k {
    color: var(--text-3);
    flex: 0 0 auto;
    font-size: 12px;
  }

  .row .c-field .v {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 桌面网格里的独立列在手机端不直接显示（已折进 c-fields） */
  .row .c-meta,
  .row .c-time { display: none; }

  .pager {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-top: 10px;
    padding: 11px 14px;
  }

  /* 抽屉全屏，便于看材料 */
  .drawer {
    width: 100vw;
    max-width: 100vw;
  }

  .drawer-head { padding: 14px 16px; }
  .drawer-head h2 { font-size: 16px; }
  .drawer-body { padding: 12px 12px 80px; }

  .sec { border-radius: 12px; }
  .sec-head { padding: 12px 14px; }
  .sec-body { padding: 13px 14px; }

  /* 键值对：手机上标签列收窄 */
  .kv {
    grid-template-columns: 78px 1fr;
    gap: 7px 10px;
    font-size: 13px;
  }

  /* 状态按钮加大，方便手指点 */
  .btn-sm {
    height: 34px;
    padding: 0 13px;
    font-size: 13px;
  }

  .status-row { gap: 8px; }
  .status-actions { gap: 8px; }
  .status-actions .btn { flex: 1 1 auto; min-width: 96px; }

  /* 缩略图放大，手机上更好点 */
  .thumb { width: 104px; height: 72px; }

  /* 弹窗在手机上贴底，键盘弹出时不遮输入框 */
  .modal-mask {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal textarea { font-size: 16px; min-height: 84px; }
  .modal input { font-size: 16px !important; }

  .modal-foot .btn { flex: 1; height: 42px; }

  .toast {
    top: auto;
    bottom: calc(24px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 40px);
  }

  .lightbox { padding: 12px; }
}

/* ---------- ≤ 560px：手机 ---------- */
@media (max-width: 560px) {
  .content { padding: 10px; }

  .row { padding: 12px; border-radius: 10px; }

  .row .c-name { font-size: 14.5px; padding-right: 54px; }

  .row .c-fields {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .row .c-field { font-size: 12.5px; }

  .drawer-head { padding: 12px 14px; }
  .drawer-body { padding: 10px 10px 80px; }

  .kv { grid-template-columns: 72px 1fr; }

  .thumb { width: 92px; height: 64px; }

  .sec-head { font-size: 13px; }

  /* 状态按钮在窄屏上两列排布 */
  .status-actions .btn { min-width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); }
}

/* 横屏矮屏（如手机横放）：抽屉内容少留白 */
@media (max-height: 480px) {
  .drawer-body { padding-bottom: 40px; }
}
