/* 展陌公司记账 - 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --income: #16a34a;
  --income-bg: #dcfce7;
  --expense: #dc2626;
  --expense-bg: #fee2e2;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-2: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
}
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: 15px;
  line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #2563eb 0%, #1e40af 55%, #1e3a8a 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .35);
  text-align: center;
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff; font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .4);
}
.login-title { font-size: 22px; font-weight: 700; color: var(--text); }
.login-sub { color: var(--text-2); margin: 6px 0 20px; font-size: 14px; }
.login-members { display: flex; flex-direction: column; gap: 10px; }
.login-member-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: #fff; font-size: 16px; color: var(--text); transition: all .15s;
}
.login-member-btn:active { background: #eff6ff; border-color: var(--primary); }
.login-member-role { font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.role-boss { background: #fef3c7; color: #b45309; }
.role-admin { background: #e0e7ff; color: #4338ca; }
.role-staff { background: #f1f5f9; color: #64748b; }
.login-tip { margin-top: 22px; font-size: 12px; color: #94a3b8; }

/* ===== 飞书登录 ===== */
.login-divider {
  display: flex; align-items: center; gap: 10px; margin: 16px 0;
  color: #94a3b8; font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.feishu-login-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 16px;
  background: #fff; border: 1.5px solid #3370ff; border-radius: var(--radius);
  color: #3370ff; font-size: 15px; font-weight: 600; text-decoration: none;
  transition: all .15s;
}
.feishu-login-btn:active { background: #f0f5ff; }
.feishu-login-btn::before {
  content: ''; width: 18px; height: 18px; flex: 0 0 18px;
  background: #3370ff;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6.8C4 5.2 5.2 4 6.8 4h10.4C18.8 4 20 5.2 20 6.8v10.4c0 1.6-1.2 2.8-2.8 2.8H6.8C5.2 20 4 18.8 4 17.2V6.8z"/><path d="M12.2 8.2c-1.3 0-2.1.6-2.1 1.8v1.4H8.6v-1.5c0-2 1.3-3.2 3.6-3.2h1.7V8.9h-1.3c-.8 0-1.4.4-1.4 1.2v1.3h2.7l-.5 1.4h-2.2v5.3H9.5v-5.3H8.6v-1.4h.9V10c0-1.2.8-1.8 2.1-1.8h.6z"/></svg>') center/contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6.8C4 5.2 5.2 4 6.8 4h10.4C18.8 4 20 5.2 20 6.8v10.4c0 1.6-1.2 2.8-2.8 2.8H6.8C5.2 20 4 18.8 4 17.2V6.8z"/><path d="M12.2 8.2c-1.3 0-2.1.6-2.1 1.8v1.4H8.6v-1.5c0-2 1.3-3.2 3.6-3.2h1.7V8.9h-1.3c-.8 0-1.4.4-1.4 1.2v1.3h2.7l-.5 1.4h-2.2v5.3H9.5v-5.3H8.6v-1.4h.9V10c0-1.2.8-1.8 2.1-1.8h.6z"/></svg>') center/contain no-repeat;
}

/* ===== 主应用框架 ===== */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #fff; border-bottom: 1px solid var(--border);
}
.app-title { font-size: 17px; font-weight: 700; }
.app-subtitle { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.app-header-right { display: flex; gap: 8px; }
.btn-icon {
  width: 38px; height: 38px; border: none; border-radius: 10px;
  background: #eff6ff; color: var(--primary); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:active { background: #dbeafe; }

.page-container { flex: 1; padding: 14px 14px 90px; max-width: 640px; width: 100%; margin: 0 auto; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; border: none; background: none; padding: 8px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-2); font-size: 11px;
}
.tab-item .tab-ico { font-size: 20px; line-height: 1; }
.tab-item.active { color: var(--primary); font-weight: 600; }

/* ===== 通用卡片/组件 ===== */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.card-title .link { font-size: 12px; color: var(--primary); font-weight: 400; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-size: 20px; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value.income { color: var(--income); }
.stat-value.expense { color: var(--expense); }
.stat-value.warn { color: var(--warn); }
.stat-value.primary { color: var(--primary); }
.stat-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-approved { background: var(--income-bg); color: var(--income); }
.badge-rejected { background: var(--expense-bg); color: var(--expense); }
.badge-received, .badge-paid { background: var(--income-bg); color: var(--income); }
.badge-overdue { background: var(--expense-bg); color: var(--expense); }

/* 列表项 */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #fff;
}
.avatar-income { background: #16a34a; }
.avatar-expense { background: #dc2626; }
.avatar-blue { background: var(--primary); }
.avatar-gray { background: #94a3b8; }
.list-body { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 600; }
.list-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.list-amount { font-size: 15px; font-weight: 700; white-space: nowrap; }
.amount-income { color: var(--income); }
.amount-expense { color: var(--expense); }
.list-actions { display: flex; gap: 6px; }
.mini-btn { border: none; background: #f1f5f9; color: var(--text-2); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.mini-btn.primary { background: #eff6ff; color: var(--primary); }
.mini-btn.danger { background: var(--expense-bg); color: var(--expense); }
.mini-btn.success { background: var(--income-bg); color: var(--income); }
.empty-tip { text-align: center; color: var(--text-2); padding: 30px 0; font-size: 13px; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 15px; background: #fff; color: var(--text); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { min-height: 70px; resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-row > div { flex: 1; }

.seg { display: flex; background: #eef2f7; border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.seg-btn { flex: 1; border: none; background: none; padding: 9px 0; border-radius: 8px; font-size: 14px; color: var(--text-2); }
.seg-btn.active { background: #fff; color: var(--primary); font-weight: 700; box-shadow: 0 1px 3px rgba(15,23,42,.1); }

.btn-primary {
  width: 100%; border: none; border-radius: 10px; padding: 13px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { width: 100%; border: 1.5px solid var(--border); background: #fff; border-radius: 10px; padding: 12px; font-size: 14px; color: var(--text-2); }

/* 附件预览 */
.upload-box {
  border: 1.5px dashed var(--border); border-radius: 10px; padding: 18px;
  text-align: center; color: var(--text-2); font-size: 13px; background: #f8fafc;
}
.upload-box.has-file { border-color: var(--income); color: var(--income); }
.upload-preview { max-width: 100%; border-radius: 8px; margin-top: 8px; display: block; }

/* 底部弹出面板 */
.sheet-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: #fff; border-radius: 16px 16px 0 0; padding: 18px 16px 24px;
  max-height: 86vh; overflow-y: auto;
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(30%); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-header span { font-size: 16px; font-weight: 700; }

/* 报表图表 */
.chart-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chart-bar-label { width: 76px; font-size: 12px; color: var(--text-2); text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bar-track { flex: 1; height: 18px; background: #f1f5f9; border-radius: 9px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 9px; }
.chart-bar-value { width: 64px; font-size: 12px; font-weight: 600; flex-shrink: 0; }

/* 表格（报表） */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-2); font-weight: 500; }
.table th:first-child, .table td:first-child { text-align: left; }
.table .pos { color: var(--income); }
.table .neg { color: var(--expense); }

/* Toast */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,.88); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 100; max-width: 86vw; text-align: center;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 管理页角色说明 */
.role-tag { font-size: 11px; padding: 2px 8px; border-radius: 8px; }
