/* 差旅费用管理工具 · Web 管理后台样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4f46e5; --primary-dark: #4338ca; --primary-light: #eef2ff;
  --bg: #f1f5f9; --card: #ffffff; --sidebar: #1e293b;
  --text: #0f172a; --text2: #64748b; --text3: #94a3b8;
  --border: #e2e8f0;
  --amber: #d97706; --amber-bg: #fef3c7;
  --blue: #2563eb; --blue-bg: #dbeafe;
  --teal: #0d9488; --teal-bg: #ccfbf1;
  --green: #16a34a; --green-bg: #dcfce7;
  --red: #dc2626; --red-bg: #fee2e2;
  --purple: #7c3aed; --purple-bg: #ede9fe;
  --gray: #64748b; --gray-bg: #f1f5f9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
}
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录页 ---------- */
#login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #6d28d9 100%); }
.login-card { background: #fff; border-radius: 20px; width: 400px; padding: 40px 36px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-logo .logo-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
.login-card h1 { font-size: 22px; font-weight: 700; }
.login-sub { color: var(--text2); font-size: 13px; margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; outline: none; transition: border .15s; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 500; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); } .btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text2); } .btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--green); color: #fff; } .btn-success:hover { background: #15803d; }
.btn-amber { background: var(--amber); color: #fff; } .btn-amber:hover { background: #b45309; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.login-accounts { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border); }
.login-accounts .t { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.account-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.account-row:hover { background: var(--primary-light); }
.account-row .n { font-weight: 500; font-size: 13px; }
.account-row .d { font-size: 12px; color: var(--text2); }
.account-row .r { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--gray-bg); color: var(--text2); }

/* ---------- 主布局 ---------- */
#app { display: none; min-height: 100vh; }
.app-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar); color: #cbd5e1; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20; }
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo .logo-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.sidebar .logo .t { color: #fff; font-weight: 600; font-size: 15px; }
.sidebar .logo .s { font-size: 11px; color: #94a3b8; }
.nav { flex: 1; padding: 14px 10px; }
.nav .group { font-size: 11px; color: #64748b; padding: 10px 10px 6px; letter-spacing: .5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: #cbd5e1; font-size: 14px; margin-bottom: 2px; transition: background .15s; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.nav-item .ic { width: 18px; text-align: center; }
.sidebar .user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.sidebar .user .u-name { color: #fff; font-weight: 500; font-size: 13px; line-height: 1.2; }
.sidebar .user .u-role { font-size: 11px; color: #94a3b8; }
.sidebar .user .logout { margin-left: auto; color: #94a3b8; cursor: pointer; font-size: 16px; padding: 4px; } .sidebar .user .logout:hover { color: #f87171; }
.main { flex: 1; margin-left: 220px; padding: 24px 28px; min-height: 100vh; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head .desc { color: var(--text2); font-size: 13px; margin-top: 4px; }

/* ---------- 统计卡片 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-card .v { font-size: 26px; font-weight: 700; margin: 6px 0 2px; }
.stat-card .l { font-size: 12px; color: var(--text2); }
.stat-card .ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; }

/* ---------- 面板/卡片 ---------- */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 18px; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-head h3 { font-size: 15px; font-weight: 600; }
.panel-body { padding: 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--text3); font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #f8fafc; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:hover td { background: #f8fafc; }
.t-row { cursor: pointer; }
.money { font-weight: 600; font-variant-numeric: tabular-nums; }
.muted { color: var(--text3); font-size: 12px; }

/* ---------- 状态徽章 ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-teal { background: var(--teal-bg); color: var(--teal); }
.b-green { background: var(--green-bg); color: var(--green); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-purple { background: var(--purple-bg); color: var(--purple); }
.b-gray { background: var(--gray-bg); color: var(--gray); }

/* ---------- 列表卡片（待办） ---------- */
.todo-list { list-style: none; }
.todo-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.todo-item:last-child { border-bottom: none; }
.todo-item .body { flex: 1; min-width: 0; }
.todo-item .body .t { font-weight: 500; }
.todo-item .body .s { font-size: 12px; color: var(--text2); margin-top: 3px; }
.todo-item .act { flex-shrink: 0; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 16px; overflow-y: auto; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 640px; max-width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text3); cursor: pointer; padding: 4px; } .modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field { margin-bottom: 0; }

/* ---------- 详情展示 ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.detail-grid .item .k { font-size: 12px; color: var(--text3); margin-bottom: 3px; }
.detail-grid .item .v { font-weight: 500; font-size: 14px; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--border); border: 2px solid #fff; }
.tl-item.done::before { background: var(--green); }
.tl-item.cur::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.tl-item.rej::before { background: var(--red); }
.tl-item .t { font-weight: 500; font-size: 13px; }
.tl-item .s { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ---------- 发票上传识别 ---------- */
.drop-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 26px; text-align: center; color: var(--text2); cursor: pointer; transition: all .15s; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.recognize-box { background: var(--primary-light); border-radius: 12px; padding: 16px; margin-top: 14px; }
.recognize-box .line { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.recognize-box .line:last-child { margin-bottom: 0; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--primary); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inv-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.inv-row:last-child { border-bottom: none; }
.inv-row .type-tag { font-size: 12px; padding: 3px 10px; border-radius: 6px; background: var(--primary-light); color: var(--primary); font-weight: 500; flex-shrink: 0; }
.inv-row .info { flex: 1; font-size: 13px; }
.inv-row .amt { font-weight: 600; }
.inv-row .del { color: var(--text3); cursor: pointer; font-size: 15px; padding: 4px; } .inv-row .del:hover { color: var(--red); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty .ic { font-size: 34px; margin-bottom: 8px; }

/* ---------- 提示 ---------- */
#toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px); background: #0f172a; color: #fff; padding: 10px 22px; border-radius: 10px; font-size: 13px; z-index: 200; opacity: 0; transition: all .25s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: var(--green); }
#toast.err { background: var(--red); }

/* 审批进度条 */
.flow-progress { display: flex; align-items: center; gap: 0; margin: 14px 0 4px; }
.flow-step { flex: 1; text-align: center; position: relative; }
.flow-step .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border); margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text3); }
.flow-step.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.flow-step.cur .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.flow-step.rej .dot { background: var(--red); border-color: var(--red); color: #fff; }
.flow-step .lb { font-size: 12px; color: var(--text2); margin-top: 6px; }
.flow-step .st { font-size: 11px; color: var(--text3); }
.flow-step::after { content: ''; position: absolute; top: 11px; right: 50%; width: 100%; height: 2px; background: var(--border); z-index: -1; }
.flow-step:first-child::after { display: none; }
.flow-step.done::after, .flow-step.cur::after { background: var(--green); }
