/* 运营团队工作管理系统 —— 全局样式（移动端优先，≤768px 底部标签栏，360px 无横向滚动） */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
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-text-size-adjust: 100%;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; width: 100%; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 28px 22px; width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 18px; }
.logo { width: 52px; height: 52px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 26px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.logo.sm { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; margin: 0 8px 0 0; }
.login-brand h1 { font-size: 18px; }
.login-brand p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.login-card label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.login-card input { margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.login-card input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.demo-hint { margin-top: 14px; font-size: 12px; color: var(--muted); background: #f8fafc; border-radius: 8px; padding: 10px; }

/* ---------- 应用骨架 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 216px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.side-brand { padding: 16px; font-weight: 600; color: #fff; display: flex; align-items: center; }
.side-brand .logo.sm { background: var(--primary); }
#nav { flex: 1; padding: 8px; overflow-y: auto; }
#nav a { display: block; padding: 10px 12px; border-radius: 8px; color: #cbd5e1; text-decoration: none; margin-bottom: 2px; font-size: 14px; }
#nav a.active, #nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side-user { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.side-user #userMeta { margin-bottom: 10px; }
.side-user .sub { color: #94a3b8; font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { padding: 14px 18px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 17px; }
.seed-warn { font-size: 12px; color: var(--warn); background: #fef3c7; border-radius: 8px; padding: 4px 10px; }
.view { padding: 16px; flex: 1; }

/* 移动端底部标签栏（桌面隐藏） */
.tabbar { display: none; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; text-align: center; padding: 9px 2px 8px; font-size: 11px; color: var(--muted); text-decoration: none; }
  .tabbar a.active { color: var(--primary); font-weight: 600; }
  .tabbar a .tab-ico { display: block; font-size: 18px; line-height: 1.2; }
  .view { padding: 12px; padding-bottom: 80px; }
  .topbar { padding: 12px; }
  .topbar h2 { font-size: 16px; }
}

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 10px; }
.sub { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { margin-bottom: 10px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 14px; font-size: 13px; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: inherit; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.normal { background: #dcfce7; color: #166534; }
.badge.optimize { background: #fef9c3; color: #854d0e; }
.badge.abnormal { background: #fee2e2; color: #991b1b; }
.badge.paused { background: #e2e8f0; color: #334155; }
.badge.gray { background: #f1f5f9; color: var(--muted); }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.red { background: #fee2e2; color: var(--danger); }

.banner { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.banner.warn { background: #fef3c7; color: #92400e; }
.banner.info { background: #dbeafe; color: #1e40af; }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; background: #f8fafc; }
table.tbl td.wrap, table.tbl th.wrap { white-space: normal; }
table.tbl tr.num td { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:hover { background: #f8fafc; }
table.tbl tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
tr.voided { opacity: .5; text-decoration: line-through; }
tr.warn-red td { color: var(--danger); }

/* 指标卡 */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.metric { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.metric .v { font-size: 22px; font-weight: 700; margin: 2px 0; }
.metric .k { font-size: 12px; color: var(--muted); }
@media (min-width: 769px) { .cards { grid-template-columns: repeat(4, 1fr); } }

/* 业务线卡片 */
.biz-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 900px) { .biz-grid { grid-template-columns: repeat(2, 1fr); } }
.biz-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; cursor: pointer; border: 2px solid transparent; }
.biz-card:hover { border-color: var(--primary); }
.biz-card .kv { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; font-size: 12px; }
.biz-card .kv b { display: block; font-size: 15px; }

/* 多行录入表 */
.rows-table input, .rows-table select { padding: 6px 8px; font-size: 13px; }
.rows-table td { padding: 4px 4px; }
.mini-total { font-weight: 600; }

/* 列表条目 */
.item { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: none; }
.item .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item .head b { font-size: 14px; }
.item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.item .excerpt { font-size: 13px; color: #334155; margin-top: 4px; }

/* 状态提醒 */
.remind { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

/* 补充记录 */
.addition { background: #f8fafc; border-left: 3px solid var(--primary); padding: 8px 10px; border-radius: 0 8px 8px 0; margin-top: 6px; font-size: 13px; }
.addition .t { color: var(--muted); font-size: 11px; margin-bottom: 2px; }

/* tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--card); border-radius: 12px; padding: 18px; width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto; }
.modal-card h3 { margin-bottom: 12px; font-size: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* toast */
#toastRoot { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 92vw; }
.toast { background: #0f172a; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); animation: fadeIn .15s ease; max-width: 92vw; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* 分页 */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 12px; font-size: 13px; color: var(--muted); }

/* 时间线 */
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline .tl-item { padding: 6px 0; }
.timeline .tl-item .t { font-size: 12px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 13px; }
.loading { text-align: center; color: var(--muted); padding: 30px 0; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb8 { margin-bottom: 8px; }
.right { text-align: right; } .nowrap { white-space: nowrap; }

/* ---------- 多业务线（multiline V1.1）新增 ---------- */

/* 业务线复选框组（C6 建号/编辑）：横向 wrap，移动端自动换列 */
.biz-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.biz-checks label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.biz-checks input[type="checkbox"] { width: auto; }

/* 日报多线页签：移动端横向可滚动（360px 可用，P0-13） */
.wl-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.wl-tabs button { white-space: nowrap; flex-shrink: 0; }

/* 逐线提交状态徽标（C1：geo ✓ 09:12 / pet ✗ 未交） */
.line-status { display: inline-block; margin-right: 10px; font-size: 12px; white-space: nowrap; }
.line-status.ok { color: var(--ok); }
.line-status.miss { color: var(--danger); font-weight: 600; }
