/* ============================================================
 *  style.css — 虾苗孵化管理系统
 *  浅色主题，移动端优先，PC 端侧边栏布局
 * ============================================================ */
:root {
  --primary: #0b6b5e;
  --primary-2: #12897a;
  --primary-soft: #e6f4f1;
  --accent: #e8833a;
  --danger: #d9534f;
  --warn: #e0a030;
  --ok: #2e9e6b;
  --bg: #f5f7f8;
  --card: #ffffff;
  --line: #e3e8ea;
  --text: #1f2a2e;
  --text-2: #5f6d73;
  --text-3: #93a1a7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 40, 46, .06), 0 6px 18px rgba(16, 40, 46, .05);
  --tab-h: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #0a5c52 100%);
  color: #fff; padding: 10px 14px; height: 58px;
  box-shadow: 0 2px 12px rgba(11, 107, 94, .25);
}
.brand { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none;
}
.brand-txt { min-width: 0; }
.brand-txt .t1 { font-size: 15px; font-weight: 600; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-txt .t2 { font-size: 11px; opacity: .78; }
.icon-btn {
  background: rgba(255,255,255,.14); border: 0; color: #fff; width: 34px; height: 34px;
  border-radius: 9px; display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:active { background: rgba(255,255,255,.28); }
.menu-btn { display: none; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 58px); }
.sidebar {
  width: 208px; flex: none; background: #fff; border-right: 1px solid var(--line);
  padding: 12px 10px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto;
}
.nav-group { font-size: 11px; color: var(--text-3); padding: 12px 10px 4px; letter-spacing: .5px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  color: var(--text-2); cursor: pointer; font-size: 13.5px; user-select: none;
}
.nav-item:hover { background: #f2f6f6; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; opacity: .85; }
.nav-item .badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 10.5px; padding: 1px 6px; border-radius: 9px; font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px 4px 4px; display: flex; flex-direction: column; gap: 6px; }
.mask { display: none; }
.main { flex: 1; min-width: 0; padding: 16px 18px 90px; }

/* ---------- 手机底部 tab ---------- */
.tabbar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; height: var(--tab-h);
  background: #fff; border-top: 1px solid var(--line); z-index: 45;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tb {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-3); font-size: 10.5px; cursor: pointer;
}
.tabbar .tb.active { color: var(--primary); }
.tabbar .tb .ico { font-size: 18px; line-height: 1; }

/* ---------- 卡片 / 通用 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; }
.page-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px;
}
.card h3 { font-size: 14.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 .hint { font-weight: 400; font-size: 12px; color: var(--text-3); }

.btn {
  border: 0; background: var(--primary); color: #fff; padding: 8px 15px; border-radius: 9px;
  cursor: pointer; font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center;
  gap: 5px; white-space: nowrap; transition: filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { filter: brightness(.93); }
.btn.ghost { background: #fff; color: var(--text-2); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.tag { display: inline-block; padding: 1.5px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 500; }
.tag.g { background: #e7f6ee; color: #1f7a4d; }
.tag.y { background: #fdf3e0; color: #a87417; }
.tag.r { background: #fdeaea; color: #b23b38; }
.tag.b { background: var(--primary-soft); color: var(--primary); }
.tag.n { background: #eef1f3; color: var(--text-2); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: .8; }
.kpi.orange::after { background: var(--accent); }
.kpi.blue::after { background: #3d7bc4; }
.kpi.green::after { background: var(--ok); }
.kpi.red::after { background: var(--danger); }
.kpi .k { font-size: 12px; color: var(--text-3); }
.kpi .v { font-size: 22px; font-weight: 650; margin-top: 2px; letter-spacing: -.4px; }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.kpi .d { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
table.tb th {
  text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfcfc;
  position: sticky; top: 0;
}
table.tb td { padding: 9px 10px; border-bottom: 1px solid #f0f3f4; vertical-align: middle; }
table.tb tr:last-child td { border-bottom: 0; }
table.tb tbody tr:hover { background: #fafcfc; }
table.tb .r { text-align: right; font-variant-numeric: tabular-nums; }
table.tb .c { text-align: center; }
table.tb tfoot td { font-weight: 600; background: #f8fbfb; border-top: 2px solid var(--line); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 池位看板 ---------- */
.workshop-block { margin-bottom: 16px; }
.ws-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ws-head .nm { font-weight: 600; font-size: 14px; }
.ws-head .st { font-size: 12px; color: var(--text-3); }
.ws-head .bar { flex: 1; height: 5px; background: #eef1f2; border-radius: 3px; overflow: hidden; max-width: 180px; }
.ws-head .bar i { display: block; height: 100%; background: var(--primary-2); }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 7px; }
.pool {
  border-radius: 9px; padding: 7px 8px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; position: relative; transition: transform .1s, box-shadow .15s; min-height: 62px;
}
.pool:hover { box-shadow: 0 3px 10px rgba(0,0,0,.07); transform: translateY(-1px); }
.pool .pn { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pool .ps { font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool .pq { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool.idle { background: #fafbfb; border-style: dashed; }
.pool.idle .pn { color: var(--text-3); }
.pool.running { background: #eef7f4; border-color: #b9dfd5; }
.pool.running .pn { color: var(--primary); }
.pool.ready { background: #fff4e8; border-color: #f4c793; box-shadow: 0 0 0 2px rgba(232,131,58,.12); }
.pool.ready .pn { color: #b1601c; }
.pool.hold { background: #f6f1f1; border-color: #e6d3d3; }
.pool.done { background: #f2f0f8; border-color: #d5cfe8; }
.pool.done .pn { color: #6b5aa0; }
.pool.done .dot { background: #8b76c2; }
.pool .dot { position: absolute; right: 6px; top: 6px; width: 6px; height: 6px; border-radius: 50%; }
.pool.running .dot { background: var(--primary-2); }
.pool.ready .dot { background: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ---------- 进度条 ---------- */
.pbar { height: 6px; background: #eef1f2; border-radius: 3px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-2), #38b39e); border-radius: 3px; }
.pbar.warm i { background: linear-gradient(90deg, #efa04f, var(--accent)); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(18,137,122,.1);
}
.field .tip { font-size: 11px; color: var(--text-3); }
.field.full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(15, 30, 34, .45); z-index: 100;
  display: none; align-items: flex-end; justify-content: center; padding: 0;
  backdrop-filter: blur(2px);
}
.modal-wrap.show { display: flex; }
.modal {
  background: #fff; width: 100%; max-width: 720px; max-height: 92vh; border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column; animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(28px); opacity: .6 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15.5px; }
.modal-head .icon-btn { background: #f2f5f5; color: var(--text-2); width: 30px; height: 30px; border-radius: 8px; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(10px);
  background: #223033; color: #fff; padding: 9px 18px; border-radius: 20px; font-size: 13px;
  opacity: 0; transition: all .25s; z-index: 200; pointer-events: none; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 34px 16px; color: var(--text-3); font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .5; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: #e7ecee; }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ''; position: absolute; left: -17px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--primary-2); }
.tl-item.warn::before { border-color: var(--accent); }
.tl-item .t { font-size: 12px; color: var(--text-3); }
.tl-item .c { font-size: 13.5px; margin-top: 1px; }

/* ---------- 图表 ---------- */
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }

/* ---------- 工具类 ---------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.sm { font-size: 12px; }
.bold { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.seg { display: inline-flex; background: #eef2f3; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.seg button.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .sidebar {
    position: fixed; left: 0; top: 58px; bottom: 0; width: 232px; z-index: 60;
    transform: translateX(-104%); transition: transform .24s ease; height: calc(100vh - 58px);
    box-shadow: 6px 0 24px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: none; }
  .mask.show { display: block; position: fixed; inset: 58px 0 0 0; background: rgba(0,0,0,.3); z-index: 55; }
  .main { padding: 12px 12px 84px; }
  .tabbar { display: flex; }
  .page-head h2 { font-size: 17px; }
  .kpi .v { font-size: 19px; }
  .pool-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
  .table-wrap { margin: 0 -12px; padding: 0 12px; }
  .modal { max-height: 94vh; }
  .hide-sm { display: none !important; }
}
@media (min-width: 861px) {
  .modal-wrap { align-items: center; padding: 24px; }
  .modal { border-radius: 16px; }
}
@media print {
  .topbar, .sidebar, .tabbar, .page-actions, .btn { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; }
}
