/* ============================================================
 * styles.css — 计量检测阿米巴经营管理系统
 * 浅色主题 · 响应式
 * ============================================================ */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #8a94a6;
  --line: #e8ecf3;
  --primary: #2f6df6;
  --primary-d: #1f55d6;
  --pos: #16a34a;
  --neg: #e8537a;
  --shadow: 0 1px 3px rgba(20,40,80,.06), 0 6px 20px rgba(20,40,80,.05);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ---------- 登录页 ---------- */
#login-view {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f6df6 0%, #16b1a4 100%);
}
.login-box {
  width: 360px; max-width: 90vw; background: #fff; border-radius: 16px; padding: 36px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-box .inp { width: 100%; margin-bottom: 14px; }
.login-error { color: var(--neg); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--muted); background: #f6f8fc; padding: 10px 12px; border-radius: 8px; }

/* ---------- 应用骨架 ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #0f1c33; color: #cdd6e6; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { font-size: 16px; font-weight: 700; color: #fff; padding: 8px 10px 18px; line-height: 1.3; }
.brand small { display: block; font-size: 11px; color: #7e8aa3; font-weight: 400; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px;
  color: #cdd6e6; text-decoration: none; margin-bottom: 4px; cursor: pointer; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar .spacer { flex: 1; }
#nav-logout { color: #ff9bac; }
#nav-logout:hover { background: rgba(255,80,110,.15); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 18px; gap: 12px; position: sticky; top: 0; z-index: 5;
}
.topbar .title { font-weight: 600; }
.topbar .user { margin-left: auto; color: var(--muted); font-size: 13px; }
#nav-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink); }
.content { padding: 20px; overflow-x: hidden; }

/* ---------- 通用组件 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 19px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-title { color: var(--muted); font-size: 12px; }
.kpi-val { font-size: 20px; font-weight: 700; margin-top: 6px; }
.kpi-arrow { font-size: 12px; }
.kpi-val.pos, .pos { }
.kpi-val .kpi-arrow.pos { color: var(--pos); }

.btn {
  display: inline-block; background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--primary-d); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.btn-ghost:hover { border-color: #cfd8e8; }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost.danger, .link.danger { color: var(--neg); }
.btn-mini { margin-left: auto; font-size: 12px; background: #eef3ff; color: var(--primary); border: none; border-radius: 6px; padding: 4px 10px; cursor: pointer; }

.inp {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 14px; background: #fff; color: var(--ink);
  width: 100%; outline: none;
}
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,109,246,.12); }
select.inp { cursor: pointer; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; background: #fafbfe; position: sticky; top: 0; }
.tbl tbody tr:hover { background: #f8faff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef1f6; color: #5b6675; }
.badge.done { background: #d1f4e0; color: var(--pos); }
.badge.pending { background: #e8f0ff; color: var(--primary); }
.badge.urgent { background: #fff3dc; color: #f6972f; }
.badge.overdue { background: #ffe4ea; color: var(--neg); }
.actions a { margin-right: 10px; }
.link { color: var(--primary); text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- 日期选择 ---------- */
.date-picker-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.date-picker-row .inp { width: auto; min-width: 140px; }
.date-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.date-chip { white-space: nowrap; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-size: 13px; color: #5b6675; }
.date-chip:hover { border-color: #b9c4d8; }
.date-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 筛选 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.filter-bar .inp { width: auto; min-width: 140px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 12px 2px 2px; }

/* ---------- 新闻 ---------- */
.news-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.news-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fcfdff; }
.news-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.news-meta { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.news-sum { color: #5b6675; font-size: 13px; }

/* ---------- 报表 ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tab { padding: 9px 16px; text-decoration: none; color: var(--muted); font-size: 14px; border-radius: 8px 8px 0 0; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }

/* ---------- Excel 式每日计划表 ---------- */
.excel-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.excel-tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1340px; }
.excel-tbl thead th {
  background: #eef2f9; color: #5b6675; font-weight: 600; padding: 10px 10px;
  white-space: nowrap; position: sticky; top: 0; z-index: 1; border: 1px solid var(--line); text-align: left;
}
.excel-tbl tbody td { padding: 0; border: 1px solid var(--line); vertical-align: middle; background: #fff; }
.excel-tbl tbody tr:hover td { background: #f7faff; }
.excel-tbl tr.ex-new-row td { background: #fbfdff; }
.ex-inp {
  width: 100%; border: none; background: transparent; padding: 9px 10px; font-size: 13px;
  color: var(--ink); outline: none; border-radius: 0; font-family: inherit;
}
.ex-inp:focus { background: #eaf1ff; box-shadow: inset 0 0 0 2px var(--primary); }
.excel-tbl select.ex-inp { cursor: pointer; }
.excel-tbl input.ex-inp[type="date"], .excel-tbl input.ex-inp[type="time"] { min-width: 132px; }
.excel-tbl td.ex-ro { padding: 9px 10px; white-space: nowrap; color: #5b6675; }
.excel-tbl td.op-col { width: 60px; text-align: center; padding: 6px; }
.ex-del {
  border: none; background: #ffe9ee; color: var(--neg); border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: 13px; line-height: 1;
}
.ex-del:hover { background: #ffd0db; }
.excel-tbl td.chk-col { width: 38px; text-align: center; padding: 0; background: #fafbfe; }
.excel-tbl thead th.chk-col { text-align: center; }
.excel-tbl input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }

/* ---------- 用户管理表格（紧凑输入） ---------- */
.inp-sm { width: auto; min-width: 90px; padding: 5px 8px; font-size: 13px; }
.tbl td .inp-sm { width: 100%; min-width: 0; }

/* ---------- 横向条形图（统计） ---------- */
.hbar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.hbar-label { width: 130px; flex-shrink: 0; font-size: 13px; color: #5b6675; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { flex: 1; background: #eef1f6; border-radius: 6px; height: 16px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 6px; min-width: 3px; transition: width .3s ease; }
.hbar-val { width: 70px; flex-shrink: 0; text-align: right; font-size: 13px; font-weight: 600; color: var(--ink); }

/* ---------- 表单 ---------- */
.form-card { max-width: 720px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-field { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: #5b6675; margin-bottom: 6px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---------- 看板提醒条 ---------- */
.reminder-banner {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  background: linear-gradient(135deg, #fff7ed, #fff1f3);
  border: 1px solid #ffd9c2; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 16px;
}
.rb-item { display: flex; flex-direction: column; align-items: flex-start; }
.rb-num { font-size: 24px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.rb-num.neg { color: var(--neg); }
.rb-label { font-size: 12px; color: var(--muted); }
.rb-link { margin-left: auto; color: var(--primary); text-decoration: none; font-weight: 600; font-size: 14px; }
.rb-link:hover { text-decoration: underline; }

/* ---------- 每日收益汇总条（每日计划与收益绑定） ---------- */
.day-rev {
  display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px;
  background: linear-gradient(135deg, #eef5ff, #f3fbff);
  border: 1px solid #cfe0ff; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px;
}
.dr-item { display: flex; flex-direction: column; min-width: 120px; justify-content: center; }
.dr-num { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.dr-num.pos { color: var(--pos); }
.dr-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dr-note {
  flex-basis: 100%; font-size: 12px; color: #6b7689;
  background: #fff; border: 1px dashed #cfe0ff; border-radius: 8px; padding: 7px 10px; margin-top: 2px;
}

/* ---------- 空状态提示（销售 / 运营无每日计划） ---------- */
.empty-note {
  padding: 26px 18px; color: #6b7689; background: #f8fafd;
  border: 1px dashed var(--line); border-radius: 10px; font-size: 14px; line-height: 1.6;
}

/* ---------- 点击跳转（看板 / 报表 下钻） ---------- */
.kpi-card[data-nav] { transition: box-shadow .15s ease, transform .15s ease; }
.kpi-card[data-nav]:hover { box-shadow: 0 6px 18px rgba(47,109,246,.18); transform: translateY(-2px); }
.rb-item[data-nav] { padding: 4px 10px; border-radius: 8px; transition: background .15s ease; }
.rb-item[data-nav]:hover { background: rgba(47,109,246,.10); }
.chart-bar { transition: opacity .15s ease; }
.chart-bar:hover { opacity: .82; }
.tbl tbody tr[data-nav]:hover { background: #eef4ff !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .news-list { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 20; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: translateX(0); }
  #nav-toggle { display: block; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .filter-bar .inp { min-width: 120px; flex: 1 1 45%; }
}
@media (max-width: 460px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
