/* ============================================================
   我的鸡舍 —— 独立页面（不再浮在农场上）
   复用 style.css 里的卡片 / 弹窗 / 按钮样式，这里只补页面骨架
   ============================================================ */

html, body { margin: 0; padding: 0; }

.coop-body {
  /* style.css 里给小游戏写的是「body 居中 flex + 100vh 不滚动」，
     独立页面要覆盖掉，否则顶栏和内容会被当成两个 flex 项横着排、还垂直居中 */
  display: block;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: auto;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 8% -8%, rgba(91, 139, 185, .20) 0%, transparent 38%),
    radial-gradient(circle at 94% 2%, rgba(216, 164, 62, .11) 0%, transparent 31%),
    linear-gradient(180deg, #f9fbfe 0%, var(--cream) 52%, #eaf0f7 100%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ---------------- 顶栏 ---------------- */
.coop-refresh {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  box-shadow: 0 2px 7px rgba(32, 52, 47, .04);
  transition: transform .12s, background .16s;
}
.coop-refresh { padding: 6px 11px; font-size: 15px; }
.coop-back:hover, .coop-refresh:hover { background: var(--cream-2); }
.coop-back:active, .coop-refresh:active { transform: translateY(2px); }

/* ---------------- 内容 ---------------- */
.coop-main {
  /* 电脑端放宽，表格能排得开；底部多留一点给右下角的「＋」 */
  max-width: 1280px;
  padding-bottom: 100px;
}

.coop-sum {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.sum-card {
  flex: 1 1 130px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(32, 52, 47, .045);
  padding: 10px 13px;
}
.sum-card span {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: 3px;
}
.sum-card b {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.sum-card.fx { flex: 0 1 auto; }


.coop-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.9;
  background: var(--paper);
  border: 2px dashed var(--line);
  border-radius: var(--r-md, 16px);
}
.coop-empty a { color: var(--pink-d); font-weight: 700; }

/* 卡片在整页里留点呼吸感，点开编辑的提示更明显 */
.coop-list .chicken-card { position: relative; }
.coop-list .chicken-card::after {
  content: "编辑 ›";
  position: absolute;
  right: 12px;
  bottom: 9px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  opacity: .75;
}

/* ---------------- 浮层：改这两个就够了 ---------------- */
.coop-body .modal-mask { position: fixed; }
.coop-body .toast { position: fixed; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }

/* 抽屉里的小标题 */
.trade-hint b { color: var(--ink-2); }

/* 右下角「＋ 添加基金」 */
.coop-fab {
  position: fixed;
  right: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  width: 54px;
  height: 54px;
  border: 1px solid #24577c;
  border-radius: 50%;
  background: #2f6f9f;
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  font-family: inherit;
  box-shadow: 0 7px 20px rgba(36, 87, 124, .26);
  cursor: pointer;
  transition: transform .12s, box-shadow .16s;
}
.coop-fab:hover { transform: translateY(-1px); }
.coop-fab:active { transform: translateY(2px); box-shadow: 0 3px 10px rgba(36, 87, 124, .24); }

/* 添加弹窗比编辑抽屉略宽一点，代码框独占一行 */
.coop-body #addModal .modal { width: 460px; }
.coop-body #addModal .add-form { gap: 9px; }

/* ---------------- 搜索 / 筛选 / 排序 ---------------- */
.coop-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 9px;
}
.coop-tools input,
.coop-tools select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(32, 52, 47, .035);
  outline: none;
}
.coop-tools input { flex: 1; min-width: 0; }
.coop-tools input::placeholder { color: var(--ink-3); font-weight: 500; }
.coop-tools input:focus { border-color: var(--pink); }
.coop-tools select { flex: none; max-width: 132px; }

.filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.fchip {
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 99px;
  background: var(--paper);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 2px 7px rgba(32, 52, 47, .035);
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.fchip:hover { background: var(--cream-2); }
.fchip.active {
  background: #2f6f9f;
  border-color: #2f6f9f;
  color: #fff;
  box-shadow: 0 3px 8px rgba(36, 87, 124, .16);
}

/* 账户分类标签：按填写的账户名自动生成 */
.account-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: -4px 0 12px;
  align-items: center;
}
.account-row .ar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  margin-right: 2px;
}
.achip {
  padding: 4px 11px;
  border: 1px dashed rgba(196, 120, 62, .45);
  border-radius: 99px;
  background: #fdf3e7;
  color: #a2602c;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 2px 7px rgba(32, 52, 47, .03);
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.achip:hover { background: #f9e7d2; }
.achip.active {
  background: #c87a3a;
  border: 1px solid #c87a3a;
  color: #fff;
  box-shadow: 0 3px 8px rgba(178, 108, 46, .2);
}
.achip .n { opacity: .72; font-weight: 600; margin-left: 3px; }

/* ---------------- 基金列表 ---------------- */
.coop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 整行一行：基金 / 现价 / 持仓 / 成本价 / 市值 / 盈亏 / 今日 / 占比 */
.list-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.list-head {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) 84px 108px 82px 88px 104px 96px 96px 96px 58px 68px 14px;
  gap: 8px;
  min-width: 1076px;
  padding: 0 16px 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.list-head .lh {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.list-head .lh.num { justify-content: flex-end; }
.list-head .lh .arrow { font-size: 10.5px; opacity: .5; }
.list-head .lh:hover { color: var(--ink-2); }
.list-head .lh.active { color: var(--ink); }
.list-head .lh.active .arrow { opacity: 1; }
.fund-row {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) 84px 108px 82px 88px 104px 96px 96px 96px 58px 68px 14px;
  align-items: center;
  gap: 8px;
  min-width: 1076px;
  padding: 8px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 3px 12px rgba(32, 52, 47, .035);
  cursor: pointer;
  transition: transform .12s, border-color .14s;
}
.fund-row:hover { border-color: #bdd3e5; }
.fund-row:active { transform: translateY(2px); }
.fund-row.loss { background: #fbfcfb; border-color: #e5ebe7; }

.fr-main { min-width: 0; }
.fr-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fr-name .lv { font-weight: 600; color: var(--ink-3); font-size: 11px; margin-left: 4px; }
.fr-sub {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fr-sub .tag {
  display: inline-block;
  padding: 0 5px;
  margin-left: 3px;
  border-radius: 6px;
  background: var(--cream-2);
  color: var(--ink-2);
  font-weight: 700;
}
.fr-sub .tag.dca { background: #e4eef7; color: #2f6f9f; }

.fr-quote {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}
.fr-quote b { font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 800; }
.fr-quote span { font-size: 10.5px; font-weight: 700; }
.fr-cell { min-width: 0; text-align: right; }
.fr-cell em {
  display: block;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.fr-arrow { color: var(--ink-3); font-size: 17px; text-align: right; }

@media (max-width: 760px) {
  /* 窄屏保持一整行，放不下就左右滑（表头会和内容一起滚） */
  .list-scroll { margin: 0 -2px; }
  .fund-row { min-width: 1076px; padding-left: 12px; padding-right: 12px; }
  .list-head { min-width: 1076px; padding-left: 14px; padding-right: 14px; }
}
.list-hint { font-size: 11px; color: var(--ink-3); margin: 0 2px 8px; font-weight: 600; }

/* 列里的涨跌颜色要压过 .fr-cell em 的默认色 */
.fr-cell em.up { color: var(--rise); }
.fr-cell em.down { color: var(--fall); }
