/* ===== 收款管家 样式 ===== */
:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #ccfbf1;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --slate: #475569;
  --slate-light: #94a3b8;
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
  background: #fff; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
textarea { resize: vertical; min-height: 60px; }
label { font-size: 13px; color: var(--slate); display: block; margin-bottom: 4px; font-weight: 500; }

/* ===== 登录 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0f766e 0%, #134e4a 60%, #0c3a35 100%); padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px; background: #fff; border-radius: 16px;
  padding: 36px 32px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); text-align: center;
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px;
  background: var(--primary); color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--slate-light); font-size: 13px; margin-bottom: 22px; }
.login-card input { margin-bottom: 12px; text-align: center; padding: 12px; font-size: 16px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 980px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--primary); color: #fff;
  font-size: 14px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 7px 12px; border-radius: 8px; color: var(--slate); font-weight: 500; white-space: nowrap; font-size: 14px;
}
.tabs a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ===== 视图容器 ===== */
.view { max-width: 980px; margin: 0 auto; padding: 20px 16px 48px; }

/* ===== 卡片与通用 ===== */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px;
}
.card h2 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 14px; margin-bottom: 8px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; }
.muted { color: var(--slate-light); font-size: 12px; }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }

.btn {
  border: none; border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; background: var(--border); color: var(--text); transition: filter .12s; white-space: nowrap;
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--slate); }
.btn-amber { background: var(--amber); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-gray { background: #f1f5f9; color: var(--slate); }
.badge-teal { background: var(--primary-soft); color: var(--primary); }

/* ===== 统计卡片 ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 15px;
}
.stat .num { font-size: 21px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--slate); font-size: 12px; }
.stat .num.red { color: var(--danger); }
.stat .num.green { color: var(--green); }
.stat .num.teal { color: var(--primary); }
.stat .num.amber { color: var(--amber); }

/* ===== 提醒横幅 ===== */
.nag {
  border-radius: var(--radius); padding: 13px 16px; margin-bottom: 14px;
  border: 1px solid; position: relative;
}
.nag-head { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.nag-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed;
  flex-wrap: wrap;
}
.nag-item:first-of-type { border-top: none; }
.nag-red { background: var(--danger-soft); border-color: #fca5a5; }
.nag-red .nag-head { color: var(--danger); }
.nag-red .nag-item { border-top-color: #fca5a5; }
.nag-amber { background: var(--amber-soft); border-color: #fcd34d; }
.nag-amber .nag-head { color: var(--amber); }
.nag-amber .nag-item { border-top-color: #fcd34d; }
.nag-teal { background: var(--primary-soft); border-color: #99f6e4; }
.nag-teal .nag-head { color: var(--primary); }
.nag-teal .nag-item { border-top-color: #99f6e4; }
.nag .amount { font-weight: 700; font-size: 15px; }
.nag .info { color: var(--slate); font-size: 13px; }

/* ===== 列表卡片 ===== */
.item-card { display: flex; gap: 12px; align-items: flex-start; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-meta { color: var(--slate); font-size: 13px; margin-top: 3px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--slate); font-weight: 600; font-size: 12.5px; background: #fafbfc; }
tr:last-child td { border-bottom: none; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 14px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .16s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal .m-close { float: right; border: none; background: none; font-size: 20px; cursor: pointer; color: var(--slate-light); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { margin-bottom: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* 还款计划行 */
.plan-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.plan-row .del { border: 1px solid var(--border); background: #fff; color: var(--danger); border-radius: 8px; height: 38px; cursor: pointer; }

/* ===== 趋势图 ===== */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.chart .bar {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px;
}
.chart .bar .v { font-size: 10.5px; color: var(--slate); font-variant-numeric: tabular-nums; white-space: nowrap; transform: scale(.9); }
.chart .bar .col {
  width: 100%; border-radius: 5px 5px 0 0; background: var(--primary);
  opacity: .85; min-height: 3px; position: relative; transition: opacity .15s;
}
.chart .bar .col:hover { opacity: 1; }
.chart .bar .m { font-size: 10.5px; color: var(--slate-light); }
.chart .bar.zero .col { background: #e2e8f0; }

/* ===== 附件 ===== */
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.file-row:last-child { border-bottom: none; }
.file-icon {
  width: 34px; height: 34px; border-radius: 8px; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.file-name { flex: 1; min-width: 0; }
.file-name .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name .meta { font-size: 11.5px; color: var(--slate-light); }

/* ===== Toast ===== */
#toast-wrap { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); }
.toast {
  background: #1e293b; color: #fff; border-radius: 10px; padding: 11px 16px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: pop .18s ease; max-width: 100%;
}
.toast.ok { background: var(--primary); }
.toast.err { background: var(--danger); }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 46px 16px; color: var(--slate-light); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ===== 小工具 ===== */
.progress { height: 8px; border-radius: 99px; background: #e2e8f0; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.deposit-note { font-size: 12px; color: var(--slate); }
.back-link { margin-bottom: 10px; display: inline-block; font-size: 13px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.tag { font-size: 11.5px; color: var(--slate-light); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar-inner { gap: 8px; }
  .view { padding: 14px 12px 60px; }
  .nag-item { align-items: flex-start; }
}
