/* =============================================
   剧组统筹大脑 · 前端样式 v1.0
   移动优先响应式：手机底部Tab / 桌面侧边栏
   ============================================= */
:root {
  --primary: #1a6b4a;        /* 深绿主色 */
  --primary-light: #e8f3ee;
  --accent: #d97706;         /* 琥珀强调 */
  --danger: #dc2626;
  --warning: #d97706;
  --ok: #16a34a;
  --text: #1f2937;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.card h3 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 10px 16px;
  font-size: 15px; font-weight: 500; background: var(--primary); color: #fff;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: var(--danger); }
.btn-gray { background: #6b7280; }
.btn-accent { background: var(--accent); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; background: #fff; outline: none;
  transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.textarea { min-height: 80px; resize: vertical; }
.label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; font-weight: 500; }
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }

/* 状态徽章 */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved, .badge-settled, .badge-completed, .badge-boss_approved { background: #dcfce7; color: #166534; }
.badge-rejected, .badge-closed { background: #fee2e2; color: #991b1b; }
.badge-processing, .badge-admin_approved { background: #dbeafe; color: #1e40af; }
.badge-pending_admin, .badge-voucher_submitted { background: #ede9fe; color: #5b21b6; }
.badge-executable { background: #ccfbf1; color: #115e59; }
.badge-adjusted { background: #ffedd5; color: #9a3412; }

/* 状态流转条 */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--text-sub); margin-top: 8px; }
.flow .step { padding: 3px 8px; border-radius: 6px; background: #f3f4f6; }
.flow .step.on { background: var(--primary); color: #fff; }
.flow .step.done { background: #dcfce7; color: #166534; }
.flow .arrow { color: #d1d5db; }

/* 进度条 */
.progress { height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.progress .bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.progress .bar.warn { background: var(--accent); }
.progress .bar.over { background: var(--danger); }

/* 金额 */
.money { font-weight: 700; font-variant-numeric: tabular-nums; }
.money.red { color: var(--danger); }
.money.green { color: var(--ok); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #f0f9f4 0%, #e8f3ee 50%, #dcefe6 100%);
}
.login-logo {
  width: 64px; height: 64px; border-radius: 16px; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; font-weight: 800; margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
}
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 28px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 24px; box-shadow: var(--shadow-lg); }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--text-sub); text-align: center; }

/* ---------- 主布局：桌面侧边栏 / 移动底部Tab ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--border);
  display: none; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: 16px 12px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 20px; }
.sidebar .brand .logo {
  width: 38px; height: 38px; border-radius: 10px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px;
}
.sidebar .brand .name { font-weight: 700; font-size: 15px; }
.sidebar .brand .sub { font-size: 11px; color: var(--text-sub); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-radius: 8px; font-size: 14px; color: var(--text); margin-bottom: 2px;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar .spacer { flex: 1; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--border); margin-top: 12px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-card .u-name { font-size: 14px; font-weight: 600; }
.user-card .u-role { font-size: 11px; color: var(--text-sub); }

.main { flex: 1; padding-bottom: 70px; }
.page { max-width: 960px; margin: 0 auto; padding: 16px; }
.page-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.page-title .sub { font-size: 12px; color: var(--text-sub); font-weight: 400; }

/* 移动端顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 50; background: #fff;
  border-bottom: 1px solid var(--border); padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .t-title { font-size: 16px; font-weight: 700; }
.topbar .t-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-sub); }
.topbar .t-user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }

/* 移动底部Tab */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 6px; font-size: 10px; color: var(--text-sub);
  background: none; border: none;
}
.tabbar .tab .icon { font-size: 20px; margin-bottom: 2px; }
.tabbar .tab.active { color: var(--primary); font-weight: 600; }
.tabbar .tab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); margin-top: 2px; }

/* 看板 */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi .k-label { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.kpi .k-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 11px; color: var(--text-sub); margin-top: 4px; }
.kpi.warn { border-left: 4px solid var(--accent); }
.kpi.over { border-left: 4px solid var(--danger); }
.kpi.good { border-left: 4px solid var(--ok); }

/* 列表 */
.list-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 14px; font-weight: 600; word-break: break-all; }
.list-item .li-sub { font-size: 12px; color: var(--text-sub); margin-top: 3px; word-break: break-all; }
.list-item .li-meta { font-size: 11px; color: #9ca3af; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.list-empty { text-align: center; color: #9ca3af; font-size: 13px; padding: 30px 0; }

/* 明细表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px; background: #f9fafb; font-weight: 600; color: var(--text-sub); font-size: 12px; }
.tbl td { padding: 8px; border-top: 1px solid var(--border); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* 筛选栏 */
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.filter-bar .chip {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; color: var(--text-sub); white-space: nowrap;
}
.filter-bar .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 500; }

/* 时间线（留痕） */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before {
  content: ''; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--primary);
}
.tl-item .tl-content { font-size: 13px; }
.tl-item .tl-meta { font-size: 11px; color: #9ca3af; margin-top: 3px; }

/* 公告 */
.ann-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.ann-item:last-child { border-bottom: none; }
.ann-item .a-title { font-size: 14px; font-weight: 600; }
.ann-item .a-date { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.ann-item .a-content { font-size: 13px; margin-top: 6px; white-space: pre-wrap; color: #374151; }

/* 弹层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-sub); padding: 4px; }
@media (min-width: 640px) {
  .modal-mask { align-items: center; }
  .modal { border-radius: 16px; }
}

/* Toast */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(17,24,39,.92); color: #fff; padding: 10px 20px;
  border-radius: 10px; font-size: 14px; z-index: 300; max-width: 88vw;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* 加载 */
.loading { text-align: center; padding: 30px; color: var(--text-sub); font-size: 13px; }

/* 桌面端断点 */
@media (min-width: 768px) {
  .sidebar { display: flex; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .main { padding-bottom: 24px; }
  .page { padding: 24px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .page-title { font-size: 20px; }
  body { font-size: 14px; }
}

/* 帮助文本 */
.hint-text { font-size: 12px; color: #9ca3af; margin-top: 6px; }
.row-flex { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.text-sub { color: var(--text-sub); }
.text-sm { font-size: 13px; }
.text-danger { color: var(--danger); }
