/* ==========================================================================
   山东金租投资有限公司  还款管理后台
   设计语言：浅色纸感底 + 墨蓝强调色（#14213D）+ 发丝描边卡片
   — 主色只用在「重点数字 / 主按钮 / 选中态」，其余靠留白和描边分层
   — 所有数字等宽对齐（tabular-nums），金额不跳动
   ========================================================================== */

:root {
  /* 墨蓝主色 */
  --brand: #14213D;
  --brand-dark: #0B1526;
  --brand-deep: #14213D;
  --brand-soft: #EDF0F6;
  --brand-soft-2: #E2E7F0;

  /* 中性色 */
  --ink: #14213D;
  --ink-2: #5B6678;
  /* 次要文字：原来 #8A93A3 在白底上只有 3:1，太浅看不清，压到 4.6:1 */
  --ink-3: #6E7787;
  --ink-4: #6B7686;
  --line: #E4E7EC;
  --line-2: #EEF0F4;
  --ring: #E8EBF0;
  --bg: #F4F5F7;
  /* 侧边栏：浅灰导航 + 墨蓝选中项（现代后台常见那套） */
  --side-bg: #EBEDF0;
  --side-hover: #F5F6F9;
  --side-active-bg: #E3E9F5;
  --side-text: #4A5568;
  --side-text-strong: #14213D;
  --side-dim: #9AA3B2;
  --side-line: #E2E4E9;
  --panel: #FFFFFF;
  /* 品牌名用思源宋体（已随项目托管，见 /fonts/noto-serif-sc.css）；万一加载失败再回落系统宋体 */
  --brand-serif: "Noto Serif SC", "思源宋体", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;

  /* 语义色（低饱和，跟主色同一个调子） */
  --ok: #117A55;
  --ok-soft: #EAF4EF;
  --warn: #B7791F;
  --warn-soft: #FAF3E6;
  --danger: #B4323F;
  --danger-soft: #FAEEEF;
  --info: #14213D;

  /* 字号层级：正文、说明、控件、标题、数字各有固定角色 */
  --text-caption: 12px;
  --text-body: 14px;
  --text-control: 16px;
  --text-heading: 18px;
  --text-title: 22px;
  --text-page-title: 24px;
  --text-metric: 28px;
  --text-display: 42px;

  /* 圆角层级：标签、控件、内层容器、卡片、胶囊 */
  --radius-xs: 6px;
  --radius-control: 8px;
  --radius-inner: 12px;
  --radius-card: 16px;
  --radius-pill: 999px;
  --radius: var(--radius-card);
  --radius-sm: var(--radius-control);

  /* 阴影层级：卡片以描边分层，只有浮层和抬升元素使用投影 */
  --shadow-control: 0 1px 2px rgba(20, 33, 61, .06);
  --shadow-card: 0 0 0 1px var(--ring);
  --shadow-card-strong: 0 0 0 1px #D9E0EC;
  --shadow-raised: 0 4px 16px rgba(20, 33, 61, .06), 0 0 0 1px var(--ring);
  --shadow-overlay: 0 20px 52px rgba(20, 33, 61, .16), 0 0 0 1px var(--ring);
  --shadow-sm: var(--shadow-control);
  --shadow: var(--shadow-raised);
  --shadow-lg: var(--shadow-overlay);

  --side-w: 216px;
  --content-max: 1360px;
  /* 表单控件与按钮统一高度，一行里的按钮和输入框才对得齐 */
  --control-h: 40px;
  --control-h-sm: 32px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: var(--text-body);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* 原文件下载链接（合同详情的「来源文件」、上传记录里的文件名） */
.file-link { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); }
.file-link:hover { color: var(--brand-dark); text-decoration: underline; }
.file-link svg { flex: none; opacity: .7; }
.file-link:hover svg { opacity: 1; }

/* 系统设置 → 品牌与外观 */
.brand-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.brand-section-heading h4 {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: 600;
}
.brand-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 14px;
}
.brand-info-grid .field { margin-bottom: 10px; }
.brand-info-grid .field.full { grid-column: 1 / -1; }
.brand-divider {
  height: 1px;
  margin: 4px 0 14px;
  background: var(--line-2);
}
.brand-assets-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.brand-asset-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px;
  border: 1px solid #E5E9EF;
  border-radius: var(--radius-control);
  background: #FAFBFD;
}
.brand-asset-card .thumb {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: var(--radius-control);
  background-color: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: var(--shadow-card);
}
.brand-asset-card .thumb.thumb-app-icon { background-size: 38px 38px; }
.brand-asset-card .thumb.thumb-favicon {
  background-color: #fff;
  background-size: 24px 24px;
  border: 1px dashed var(--line);
  box-shadow: none;
}
.brand-asset-card .meta { flex: 1; min-width: 0; }
.brand-asset-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 21px;
  flex-wrap: wrap;
}
.brand-asset-title b { font-size: var(--text-body); }
.brand-asset-title .tag { padding: 1px 7px; font-size: var(--text-caption); }
.brand-asset-card .acts {
  display: flex;
  gap: 7px;
  align-items: center;
}
.brand-asset-card .acts .btn { min-width: 0; padding: 0 10px; }
.brand-save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}

svg { display: block; }

h1, h2, h3 { letter-spacing: -.01em; }

/* ------------------------------- 登录页 ------------------------------- */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 32px 48px 26px;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 78% 8%, #FFFFFF, transparent 66%),
    radial-gradient(900px 600px at 6% 96%, #FFFFFF, transparent 60%),
    var(--bg);
}

/* 极淡的点阵，给大片留白一点质感 */
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><circle cx='1' cy='1' r='1' fill='%2314213D' fill-opacity='0.05'/></svg>");
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.login-page > * { position: relative; z-index: 1; }

.login-top { display: flex; align-items: center; gap: 12px; }
.login-top .mark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
}
/* 纯透明 Logo 直接放在页面底色上，不再套白色圆角块 */
.login-top .mark img { width: 36px; height: 36px; }
/* 公司名：思源宋体 + 纯黑，字号跟左边的 logo 方块配比例 */
.login-top .cn {
  font-family: var(--brand-serif);
  font-size: var(--text-metric);
  font-weight: 900;
  letter-spacing: .2px;
  color: #000;
  line-height: 1.25;
}

.login-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 396px;
  align-items: center;
  gap: 56px;
  padding: 40px 0;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.login-hero h1 {
  margin: 0;
  font-family: var(--brand-serif);
  font-size: var(--text-display);
  line-height: 1.35;
  font-weight: 900;
  letter-spacing: 0;
  color: var(--ink);
}
.login-hero em { font-style: normal; color: #7A8494; }

.login-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 30px 30px 28px;
  box-shadow: var(--shadow-overlay);
  color: var(--ink);
}
.login-fields {
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid #E2E6EC;
  border-radius: var(--radius-inner);
  background: #F9FAFC;
}
.login-control {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 15px;
  background: transparent;
  transition: background .15s, box-shadow .15s;
}
.login-control + .login-control {
  border-top: 1px solid #E7EAF0;
}
.login-card .login-control input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0;
  border: none;
  font-size: var(--text-control);
  background: transparent;
  border-radius: 0;
}
.login-card .login-control input:hover,
.login-card .login-control input:focus,
.login-card .login-control input:focus-visible {
  border: none;
  box-shadow: none;
  outline: none;
  background: transparent;
}
.login-card .login-control input::placeholder { color: #8C96A5; }
.login-card .login-control input:-webkit-autofill,
.login-card .login-control input:-webkit-autofill:hover,
.login-card .login-control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px #F9FAFC inset;
  box-shadow: 0 0 0 1000px #F9FAFC inset;
  transition: background-color 99999s ease-out 0s;
}

/* 登录页：显示/隐藏密码 + 大写锁定提示 */
.pw-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 30px;
  margin-left: 6px;
  padding: 0 3px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--brand); background: rgba(20, 33, 61, .05); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pw-toggle .pw-hide { display: none; }
.pw-toggle.on .pw-show { display: none; }
.pw-toggle.on .pw-hide { display: inline; }
.caps-hint {
  font-size: var(--text-caption);
  color: #8A5A13;
  background: var(--warn-soft);
  border-radius: var(--radius-control);
  padding: 6px 10px;
  margin: -4px 0 14px;
}

#msg:empty { display: none; }

.login-card .btn { width: 100%; height: 48px; margin-top: 5px; padding: 0 16px; font-size: var(--text-body); letter-spacing: 4px; border-radius: var(--radius-inner); }

.login-copy { font-size: var(--text-caption); color: var(--ink-3); line-height: 1.9; letter-spacing: .2px; }

@media (max-width: 1024px) {
  .login-page { padding: 26px 28px 22px; }
  .login-body { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 32px; padding: 24px 0; }
  .login-hero { display: none; }
}

@media (max-width: 520px) {
  .login-card { padding: 28px 22px 24px; }
  .login-top .mark { width: 38px; height: 38px; border-radius: var(--radius-control); }
  .login-top .mark img { width: 32px; height: 32px; }
}

/* 很窄的手机上把公司名收一点，保证还是一行 */
@media (max-width: 400px) {
  .login-top .cn { font-size: var(--text-title); }
}

/* -------------------------------- 表单 -------------------------------- */

label.field { display: block; margin-bottom: 15px; }

label.field > span {
  display: block;
  font-size: var(--text-body);
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="email"], input[type="month"], select {
  width: 100%;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid #D5DAE3;
  border-radius: var(--radius-sm);
  font-size: var(--text-body);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

input:hover, select:hover, textarea:hover { border-color: #BFC7D4; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 33, 61, .08);
}

input[type="checkbox"] { accent-color: var(--brand); width: 15px; height: 15px; }

textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #D5DAE3;
  border-radius: var(--radius-sm);
  font-size: var(--text-body);
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  resize: vertical;
  min-height: 74px;
  line-height: 1.7;
}

/* -------------------------------- 按钮 -------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control-h);
  padding: 0 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font-size: var(--text-body);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-control);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none;
}

.btn:hover { background: var(--brand-dark); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn.ghost {
  background: #fff;
  color: var(--ink-2);
  border-color: #D5DAE3;
  box-shadow: none;
}
.btn.ghost:hover { background: #fff; color: var(--ink); border-color: #AEB7C6; }

.btn.danger { background: var(--danger); box-shadow: var(--shadow-control); }
.btn.danger:hover { background: #9B2A36; }
.btn.ok { background: var(--ok); box-shadow: var(--shadow-control); }
.btn.ok:hover { background: #0D6344; }

/* 表格里高频出现的操作按钮：白底细描边，跟首页看板一致 */
.btn.outline {
  background: #fff;
  color: var(--ink);
  border-color: #C9D1DE;
  box-shadow: none;
}
.btn.outline:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 表格里的「记录收款」按到期紧急程度着色，仍保持可点击 */
.btn.payment-action {
  border: 1px solid #E7EAF0;
  background: #F1F3F7;
  color: #6B7686;
  box-shadow: none;
  font-weight: 500;
}
.btn.payment-action.today {
  border-color: #EEDDBF;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
}
.btn.payment-action.overdue {
  border-color: #E7CACE;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
}
.btn.payment-action:hover {
  border-color: #CBD3DF;
  background: #E8EBF0;
  color: var(--ink-2);
}
.btn.payment-action.today:hover {
  border-color: #E4CDA6;
  background: #F5EBD8;
  color: var(--warn);
}
.btn.payment-action.overdue:hover {
  border-color: #DDB4B9;
  background: #F7E4E6;
  color: var(--danger);
}

.btn.sm {
  height: var(--control-h-sm);
  padding: 0 12px;
  border-radius: var(--radius-control);
  font-size: var(--text-body);
  font-weight: 500;
  gap: 5px;
}
.btn.block { width: 100%; height: 44px; font-size: var(--text-body); }

/* -------------------------------- 布局 -------------------------------- */

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;                 /* 品牌区与导航之间的呼吸交给下面那条渐隐细线 */
  padding: 24px 16px;
  border-right: 1px solid var(--side-line);
  background: var(--side-bg);
  position: sticky;
  top: 0;
  height: 100vh;
}

/* 品牌区：点一下相当于刷新页面，所以做成可点的样子（hover 底跟导航项同一个色） */
.sidebar .brand {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  padding: 0; margin: 0;
  border-radius: var(--radius-control); cursor: pointer;
  transition: background .15s;
}
.sidebar .brand:hover { background: var(--side-hover); }
.sidebar .brand:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sidebar .brand .mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
}
.sidebar .brand .mark img { width: 36px; height: 36px; }
.sidebar .brand .cn {
  font-family: var(--brand-serif);
  font-size: var(--text-title); font-weight: 900; color: #000; white-space: nowrap;
}

/* 品牌区和导航共用同一套左对齐网格：Logo 对准图标列，名称对准文字列。 */
.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: auto; margin-top: 20px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--side-text);
  text-decoration: none;
  font-size: var(--text-control);
  transition: background .15s, color .15s;
}

.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--side-hover); color: var(--side-text-strong); }
.nav a:hover svg { opacity: 1; }

.nav a.active {
  background: var(--side-hover);   /* 跟品牌区悬停时同一块色（#F5F6F9） */
  color: var(--brand);
  font-weight: 600;
  box-shadow: var(--shadow-control);
}
.nav a.active svg { opacity: 1; }

.nav p {
  margin: 16px 12px 4px;
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--side-dim);
}

.sidebar .foot { font-size: var(--text-body); color: var(--side-dim); line-height: 1.9; padding: 0 8px; }
.sidebar .foot a { color: var(--side-text); }
.sidebar .foot a:hover { color: var(--side-text-strong); }
.sidebar .foot .warn-pwd { color: var(--warn); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* 页面抬头与内容共用同一画面，不另做隔断 */
.page-head {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 22px 36px 20px;
  min-height: 80px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h1 {
  position: relative;
  margin: 0;
  padding-bottom: 12px;
  color: var(--ink);
  font-size: var(--text-page-title);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -.02em;
}
.page-head h1::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: rgba(20, 33, 61, .62);
}
.page-head h1[hidden] { display: none; }
.page-head .head-lead {
  min-width: 0;
  display: flex;
  align-items: center;
}
.page-head .title-line {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.page-head .head-copy {
  min-width: 0;
  display: flex;
}
.page-head .head-lead[hidden] { display: none; }
.page-head .lead { margin: 0; color: var(--ink-3); font-size: var(--text-body); line-height: 1.5; white-space: nowrap; }
.page-head .head-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.page-head .actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.date { color: var(--ink-3); font-size: var(--text-body); white-space: nowrap; }

/* 窄屏才出现的按钮（侧边栏收起时用来唤出菜单） */
.only-narrow { display: none; }

.view {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 20px 36px 72px;
}

/* -------------------------------- 卡片 -------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 16px; margin-bottom: 20px; }
.cards.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 首页：左边图表（宽）+ 右边在管项目（窄），两张卡上下对齐（等高） */
/* 下面两张卡也用和上面 KPI 一样的三栏网格：上下两排的竖缝就能对齐 */
.mid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.mid > .card { display: flex; flex-direction: column; }
.mid > .card:first-child { grid-column: span 2; }
.mid > .card .mini-chart { flex: 1; height: auto; min-height: 158px; }

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card .lab {
  font-size: var(--text-body);
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.card .val {
  font-size: var(--text-metric);
  font-weight: 650;
  letter-spacing: -.02em;
  margin: 8px 0 3px;
  word-break: break-all;
}
.card .val.sm { font-size: var(--text-title); }
.card .sub { font-size: var(--text-caption); color: var(--ink-3); }

.card.warn .val { color: var(--danger); }
.card.kpi-link { display: block; color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow .18s ease; }
.card.kpi-link:hover { box-shadow: var(--shadow-raised); }
.card.kpi-link:hover .kpi-go { color: var(--brand); }
.card.kpi-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.kpi-go { color: var(--ink-3); font-size: var(--text-caption); font-weight: 400; letter-spacing: 0; }

/* 强调卡：整块墨蓝，一页最多用一次 */
.card.accent {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-raised);
}
.card.accent .lab, .card.accent .sub { color: rgba(255, 255, 255, .72); }

.card.soft { background: #F7F8FA; }
.card.soft .val { color: var(--brand-deep); }

/* 合同详情顶部那 6 张指标卡：淡蓝灰底 + 稍明显的描边，跟白色弹窗区分开
   （首页看板的卡片不用这个类，保持白底不变） */
.cards.kpi-tinted .card {
  background: var(--brand-soft);
  box-shadow: var(--shadow-card-strong);
}
.cards.kpi-tinted .card .lab { color: var(--ink-2); }
.cards.kpi-tinted .card .bar { background: #fff; }

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel > header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel > header h3 {
  margin: 0;
  font-size: var(--text-heading);
  font-weight: 600;
  letter-spacing: -.01em;
}
.panel > header .hint { font-size: var(--text-body); color: var(--ink-3); }
.panel .body { padding: 22px 24px; }
.panel .body.tight { padding: 0; }

.card .hd, .panel .hd {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card .hd h2, .panel .hd h2 { margin: 0; font-size: var(--text-heading); font-weight: 650; letter-spacing: -.01em; }
.card .hd span, .panel .hd span, .card .hd a, .panel .hd a { color: var(--ink-3); font-size: var(--text-body); text-align: right; }

/* -------------------------------- 表格 -------------------------------- */

.table-wrap { overflow-x: auto; }

/* 列表分页条：数据超过一页才出现，贴在卡片底部 */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 22px 14px;
  border-top: 1px solid var(--line-2);
}
.pager .hint { font-size: var(--text-body); color: var(--ink-3); }
.pager-btns { display: flex; gap: 8px; }

/* 表格里列多、金额长，字号比正文小半号，行高才不至于被挤成五六行 */
table.grid { width: 100%; border-collapse: collapse; font-size: var(--text-body); }

table.grid th {
  text-align: left;
  padding: 11px 12px;
  background: #F8FAFC;
  color: var(--ink-2);
  font-weight: 600;
  font-size: var(--text-body);
  letter-spacing: .02em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}

table.grid td {
  padding: 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

table.grid tbody tr:hover { background: #FAFBFC; }
table.grid tbody tr:last-child td { border-bottom: none; }

/* 整行可点：鼠标手型 + 比普通悬停更明显一点的底色（行内的按钮、链接、下拉不受影响） */
table.grid tbody tr[data-row-open],
table.grid tbody tr[data-row-toggle],
table.grid tbody tr[data-row-download] { cursor: pointer; }
table.grid tbody tr[data-row-open]:hover,
table.grid tbody tr[data-row-toggle]:hover,
table.grid tbody tr[data-row-download]:hover { background: #F1F4F9; }

/* 表头可点排序：鼠标手型 + 激活列的箭头（点一下升序、再点降序、第三下回默认） */
table.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid th.sortable:hover { color: var(--ink); background: #FAFBFC; }
table.grid th .sort-mark { margin-left: 3px; font-size: var(--text-caption); opacity: .7; }
/* 表格确实窄到要横向滚不少时，最后一列（基本就是「操作」）钉在最右边，按钮不会被滚走。
   只差几个像素的情况不钉（那点宽度让列自己挤一挤就行，钉上去反而会盖住左边那列）。 */
.table-wrap.is-scrollable table.grid th:last-child {
  position: sticky;
  right: 0;
  background: #F8FAFC;
}
.table-wrap.is-scrollable table.grid td:last-child:not([colspan]) {
  position: sticky;
  right: 0;
  background: #fff;
}
.table-wrap.is-scrollable table.grid th:last-child { z-index: 3; }
.table-wrap.is-scrollable table.grid tbody tr:hover td:last-child:not([colspan]) { background: #FAFBFC; }
.table-wrap.is-scrollable table.grid th:last-child,
.table-wrap.is-scrollable table.grid td:last-child:not([colspan]) {
  box-shadow: -10px 0 12px -12px rgba(20, 33, 61, .45);
}

table.grid td.nw { white-space: nowrap; }
.nowrap { white-space: nowrap; }
/* 合同编号列：keep-all 让它只在 <wbr>（简称/日期之间）折行，不会把整串撑宽 */
table.grid td.code { word-break: keep-all; }
/* 列表页第一列多是企业名，给个下限，别被后面的数字列挤成三行。
   只对页面里的表格生效——弹框里的排期表第一列只是「第 N 期」，不需要这么宽 */
#view table.grid td:first-child, #view table.grid th:first-child { min-width: 120px; }
/* 承租人列比默认宽两个字（约 28px），其他列和折行规则保持原样 */
#view table.grid.enterprise-table td:first-child,
#view table.grid.enterprise-table th:first-child { min-width: 162px; }
table.grid td.num, table.grid th.num { text-align: right; }
/* 相邻的数字列之间留点缝，一眼能分清哪一列属于哪个表头 */
table.grid td.num + td.num, table.grid th.num + th.num { padding-left: 10px; }
table.grid td.center, table.grid th.center { text-align: center; }
table.grid .strong { font-weight: 600; }
table.grid .muted { color: var(--ink-3); font-size: var(--text-body); font-weight: 400; }
.next-due {
  position: relative;
  min-height: 52px;
  display: flex;
  align-items: center;
}
.next-due-date { font-weight: 600; line-height: 1.25; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-xs);
  font-size: var(--text-body);
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.65;
}

.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--brand-soft); color: var(--ink); }
.tag.mute { background: #F1F3F7; color: var(--ink-4); }
/* 已还状态本身就是“查看收款明细”的入口 */
button.status-action {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}
button.status-action:hover .tag { filter: brightness(.97); }
button.status-action:focus-visible { outline: 2px solid var(--brand-soft-2); outline-offset: 2px; }

/* 进度条 */
.bar { height: 6px; background: #E6EAF1; border-radius: 3px; overflow: hidden; min-width: 80px; margin: 12px 0 8px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.progress-cell {
  position: relative;
  width: 76px;
  min-height: 52px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}
.progress-cell .bar { width: 100%; min-width: 0; height: 5px; margin: 0; flex: none; }
.contract-progress { width: 100px; }
.progress-num {
  position: absolute;
  top: calc(50% + 8px);
  left: 0;
  right: 0;
  color: var(--ink-3);
  font-size: var(--text-caption);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

/* 关键指标行（dl） */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 16px; font-size: var(--text-body); margin: 0; }
.kv dt, .kv dd { border-top: 1px solid var(--line-2); padding: 8px 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 500; text-align: right; color: var(--ink); word-break: break-all; }
/* 来源文件那一行：文件名在左，替换按钮固定在右，长文件名不会把按钮挤走 */
.src-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.src-row .src-name { min-width: 0; text-align: right; }
/* 来源文件行：可以直接把文件拖进来 */
.src-row.over {
  background: var(--brand-soft);
  outline: 2px dashed var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
.src-row.busy { opacity: .55; pointer-events: none; }

/* 解析中心 → 数据质检中心 */
.todo-list { display: flex; flex-direction: column; }
.todo-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.todo-row:first-child { border-top: 0; padding-top: 0; }
.todo-row:last-child { padding-bottom: 0; }
.todo-main { min-width: 0; }
.todo-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.todo-row .muted { font-size: var(--text-caption); line-height: 1.7; }
.dup-group { padding: 14px 0; border-top: 1px solid var(--line-2); }
.dup-group:first-of-type { border-top: 0; padding-top: 0; }
.dup-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.todo-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; }
@media (max-width: 720px) {
  .todo-row { align-items: flex-start; flex-direction: column; gap: 10px; }
}

/* 待办业务：催收清单 */
.collection-overview {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 18px 24px; margin-bottom: 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: linear-gradient(135deg, #FAFBFD 0%, #F1F6FB 100%);
  box-shadow: var(--shadow-card);
}
.collect-stat { display: flex; flex-direction: column; gap: 6px; min-width: 170px; padding-right: 24px; border-right: 1px solid var(--line-2); }
.collect-stat-head { display: flex; align-items: center; gap: 7px; font-size: var(--text-body); color: var(--ink-3); }
.collect-stat-head .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.collect-stat-danger .dot { background: var(--danger); }
.collect-stat-warn .dot { background: var(--warn); }
.collect-stat-main { display: flex; align-items: baseline; gap: 6px; }
.collect-stat-main b { font-size: var(--text-metric); line-height: 1.1; letter-spacing: -.02em; color: var(--ink); font-weight: 650; }
.collect-stat-main span { font-size: var(--text-caption); color: var(--ink-3); }
.collect-stat-main em { margin-left: 8px; font-style: normal; font-size: var(--text-caption); color: var(--ink-3); }
.collect-overview-note { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.collect-overview-note b { font-size: var(--text-body); color: var(--ink); }
.collect-overview-note span { font-size: var(--text-caption); color: var(--ink-3); line-height: 1.7; }
.collect-customer { color: var(--ink); font-weight: 600; text-decoration: none; }
.collect-customer:hover { color: var(--brand); text-decoration: underline; }
.collect-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.collect-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.collect-search {
  display: flex; align-items: center; gap: 7px; width: 270px; height: 34px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: #fff; color: var(--ink-3);
  transition: border-color .15s, box-shadow .15s;
}
.collect-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 33, 61, .08); }
.collect-search input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; font: inherit; font-size: var(--text-caption); color: var(--ink); }
.collect-search input:focus { border-color: transparent; box-shadow: none; }
.collect-search input::placeholder { color: var(--ink-3); }
.collect-search svg { flex: none; opacity: .7; }
.collection-table .collect-latest { max-width: 260px; }
.collection-table .collect-note,
.collection-table .collect-note-meta {
  display: block;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.collection-table tr.overdue-row > td:first-child { box-shadow: inset 3px 0 var(--danger); }
.collection-table tr.due-today-row > td:first-child { box-shadow: inset 3px 0 var(--warn); }
.danger-text { color: var(--danger); }
.warn-text { color: var(--warn); }
.follow-log-list { margin-top: 8px; }
.follow-log { padding: 8px 0; border-top: 1px solid var(--line-2); font-size: var(--text-body); line-height: 1.7; }
.follow-log:first-child { border-top: 0; padding-top: 0; }
.follow-log-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.follow-log-main { min-width: 0; word-break: break-word; }
.follow-log-main .strong { font-size: var(--text-body); }
.follow-log-actions { display: flex; gap: 4px; flex: none; }
@media (max-width: 900px) {
  .collection-overview { gap: 18px; padding: 16px 20px; }
  .collect-stat { min-width: 150px; padding-right: 18px; }
  .collection-table .collect-latest { max-width: 200px; }
  .collection-table .collect-note,
  .collection-table .collect-note-meta { max-width: 180px; }
}
@media (max-width: 720px) {
  .collect-toolbar { align-items: flex-start; }
  .collect-search { flex: 1; width: auto; min-width: 180px; }
}
@media (max-width: 620px) {
  .collection-overview { gap: 14px; }
  .collect-stat { min-width: calc(50% - 8px); padding-right: 0; border-right: 0; }
  .collect-overview-note { width: 100%; min-width: 0; }
}

/* ------------------------------- 邮件提醒 ------------------------------- */
.mail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 24px;
  margin-bottom: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #F8FBFF 0%, #EEF4FB 100%);
  box-shadow: var(--shadow-card);
}
.mail-hero.is-off { background: linear-gradient(135deg, #FAFBFC 0%, #F2F4F7 100%); }
.mail-hero.is-warn { background: linear-gradient(135deg, #FFFDF7 0%, #FBF5E8 100%); }
.mail-hero-main { min-width: 0; }
.mail-hero-status { display: flex; align-items: center; gap: 7px; font-size: var(--text-caption); color: var(--ink-3); }
.mail-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.mail-hero.is-on .mail-status-dot { background: var(--ok); }
.mail-hero.is-warn .mail-status-dot { background: var(--warn); }
.mail-status-dot.ok { background: var(--ok); }
.mail-status-dot.off { background: var(--ink-3); }
.mail-hero-title { margin: 6px 0 3px; font-size: var(--text-title); font-weight: 650; letter-spacing: -.02em; }
.mail-hero-sub { font-size: var(--text-body); color: var(--ink-2); }
.mail-hero-meta { margin-top: 6px; font-size: var(--text-caption); color: var(--ink-3); line-height: 1.7; }
.mail-hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mail-msg:not(:empty) { margin-bottom: 14px; }
.mail-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.mail-settings-grid .panel { margin-bottom: 0; }
.mail-card > header.mail-card-head {
  min-height: 58px;
  padding: 12px 22px;
}
.mail-card-head > .btn { margin-left: auto; }
.mail-card-head .mail-days {
  margin-left: auto;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: #F5F7FA;
  gap: 2px;
}
.mail-card-head .mail-day-chip {
  padding: 4px 9px;
  border-color: transparent;
  background: transparent;
  font-size: var(--text-caption);
}
.mail-card-head .mail-day-chip.active {
  border-color: #DCE2EC;
  background: #FFFFFF;
  color: var(--brand);
  box-shadow: var(--shadow-control);
}
#ruleBody > .empty { padding: 24px 16px; }
.mail-card .body { padding: 20px 22px; }
.mail-adv-toggle {
  color: var(--ink-3);
  font-size: var(--text-body);
  font-weight: 500;
  white-space: nowrap;
}
.mail-advanced > summary:hover .mail-adv-toggle {
  color: var(--ink-2);
}
.mail-days { display: flex; flex-wrap: wrap; gap: 6px; }
.mail-day-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--ink-2);
  padding: 7px 13px;
  font: inherit;
  font-size: var(--text-caption);
  cursor: pointer;
}
.mail-day-chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.mail-vars { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.mail-var { border-radius: var(--radius-xs); background: var(--brand-soft); color: var(--ink-2); padding: 2px 6px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: var(--text-caption); }
.mail-theme-row { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.mail-theme-row .field { flex: 1; min-width: 220px; margin-bottom: 0; }
.mail-image-switch { padding-bottom: 9px; white-space: nowrap; }
.mail-advanced { padding: 0; }
.mail-advanced > summary { list-style: none; cursor: pointer; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.mail-advanced > summary::-webkit-details-marker { display: none; }
.mail-adv-left { display: flex; align-items: flex-start; gap: 9px; }
.mail-adv-left b { font-size: var(--text-body); }
.mail-adv-left .muted { margin-top: 3px; font-size: var(--text-caption); color: var(--ink-3); }
.mail-adv-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--text-caption); color: var(--ink-3); }
.mail-advanced .when-open { display: none; }
.mail-advanced[open] .when-closed { display: none; }
.mail-advanced[open] .when-open { display: inline; }
.mail-advanced .body { border-top: 1px solid var(--line-2); padding: 20px 22px; }
.password-change-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 12px;
}
.password-change-row .field { margin-bottom: 0; }
.settings-primary {
  min-width: 112px;
}
.password-change-row .btn { white-space: nowrap; }
.mail-smtp-note { margin-bottom: 14px; padding: 10px 12px; border-radius: var(--radius-control); background: #F7F9FC; color: var(--ink-3); font-size: var(--text-caption); line-height: 1.7; }
.mail-preview-panel .body { background: #FAFBFC; }
.mail-preview-tools { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mail-preview-tools select { width: 120px; }
.mail-preview-tools input { width: 150px; }
.mail-log-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #E7EAF0;
  border-radius: var(--radius-control);
  background: #F5F7FA;
}
.log-text-action {
  appearance: none;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.log-text-action:hover {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-control);
}
.log-text-action.danger-text { color: var(--ink-3); }
.log-text-action.danger-text:hover {
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: none;
}

@media (max-width: 1000px) {
  .mail-settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .password-change-row { grid-template-columns: 1fr; }
  .password-change-row .btn { width: 100%; }
  .mail-hero { padding: 16px 18px; }
  .mail-hero-title { font-size: var(--text-heading); }
  .mail-hero-actions { width: 100%; }
  .mail-card .body,
  .mail-advanced > summary,
  .mail-advanced .body { padding-left: 16px; padding-right: 16px; }
  .mail-preview-tools { justify-content: flex-start; }
}

/* ------------------------------- 过滤器 ------------------------------- */

.filters, .filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters label.field, .filter-row label.field { margin-bottom: 0; min-width: 152px; }
.filters .grow, .filter-row .grow { flex: 1; min-width: 210px; }

/* 让「标签 + 输入框」并排成一行（标签在左、输入框在右），跟前面的勾选项连成一句 */
.filters label.field.inline, .filter-row label.field.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.filters label.field.inline > span, .filter-row label.field.inline > span {
  margin-bottom: 0;
  white-space: nowrap;
}

/* -------------------------------- 上传 -------------------------------- */

.drop {
  border: 1.5px dashed #C9D1DE;
  border-radius: var(--radius);
  padding: 42px 20px;
  text-align: center;
  background: #FAFBFC;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.drop:hover, .drop.over { border-color: var(--brand); background: #F2F4F8; }
.drop .big { font-size: var(--text-metric); margin-bottom: 10px; color: var(--brand); display: flex; justify-content: center; }
.drop .big svg { width: 32px; height: 32px; }
.drop .t1 { font-weight: 600; font-size: var(--text-control); margin-bottom: 6px; }
.drop .t2 { color: var(--ink-3); font-size: var(--text-body); line-height: 1.8; }

.draft {
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-card);
  transition: opacity .15s;
}

.draft > .dh {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.draft.excluded { opacity: .55; }
.draft.excluded:hover { opacity: .85; }
.draft .dh .switch b { margin-right: 2px; }

.draft .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; padding: 18px; }
.draft .fields label.field { margin: 0; }

details.sched-preview { border-top: 1px solid var(--line-2); }
details.sched-preview > summary {
  padding: 12px 18px;
  cursor: pointer;
  font-size: var(--text-body);
  color: var(--ink-2);
  font-weight: 500;
  user-select: none;
}
details.sched-preview > summary:hover { color: var(--ink); }
details.sched-preview .table-wrap { max-height: 320px; overflow: auto; }

/* -------------------------------- 弹层 -------------------------------- */

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(20, 33, 61, .38);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
  z-index: 100;
  overflow: auto;
  animation: fade .16s ease;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 920px;
  /* 弹框整体不超过窗口高度，只让中间正文滚动，头和脚始终看得见 */
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .18s cubic-bezier(.2, .8, .3, 1);
}

@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99) } to { opacity: 1; transform: none } }

.modal > header {
  flex: none;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-2);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.modal > header h3 { margin: 0; font-size: var(--text-heading); font-weight: 650; letter-spacing: -.01em; }
.modal > .body { flex: 1 1 auto; min-height: 0; padding: 20px 22px; overflow: auto; }
.modal > footer {
  flex: none;
  padding: 15px 22px;
  border-top: 1px solid var(--line-2);
  display: flex; justify-content: flex-end; gap: 10px;
  background: #FAFBFC;
}
.modal > footer .grow { flex: 1 1 auto; }
.modal.narrow { max-width: 500px; }
/* 表格内容长一点的表单（比如单独提醒里选合同那一栏），比 narrow 宽、比默认窄 */
.modal.size-mid { max-width: 760px; }

/* 弹窗里的表格：表头也铺一层淡色底（跟指标卡、附件块同一套），边界更清楚；
   横向滚动时钉在最右的表头单元格跟着用同色，不然会露出一块白 */
.modal table.grid th { background: var(--brand-soft); color: var(--ink-2); font-weight: 600; }
.modal table.grid tr.diff-changed > td { background: #FFF9EC; }
.modal .table-wrap.is-scrollable table.grid th:last-child { background: var(--brand-soft); }
/* 表头顶上那两个角跟着圆一下，跟上面的指标卡、附件块一个气质 */
.modal table.grid thead th:first-child,
.plan-table thead th:first-child { border-top-left-radius: 12px; }
.modal table.grid thead th:last-child,
.plan-table thead th:last-child { border-top-right-radius: 12px; }

/* 详情页的还款明细：整块套一张圆角卡片（跟首页那张明细表一样），
   行数 / 收起开关做成卡片标题栏 */
.sched-card {
  border-radius: var(--radius-inner);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}
.sched-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--brand-soft);
  border-radius: var(--radius-inner) var(--radius-inner) 0 0;
  border-bottom: 1px solid #D9E0EC;
}
.sched-head b { font-size: var(--text-body); }
.sched-head .muted { font-size: var(--text-caption); }
/* 标题栏和列头同色连成一片，所以列头不用再自己圆角 —— 上面的圆角由卡片负责 */
.sched-card table.grid thead th:first-child,
.sched-card table.grid thead th:last-child { border-radius: 0; }
.sched-card table.grid thead th { border-bottom-color: #D9E0EC; }

/* 合同详情里的附件区：淡色底块，三类各一行，文件名做成可点的标签，点一下就是下载 */
.attach-block {
  background: var(--brand-soft);
  border-radius: var(--radius-inner);
  padding: 14px 16px;
  margin-bottom: 16px;
}
/* 「上传附件」后面直接跟括号说明，一行排下来
   （原来是左右分栏，说明一长就掉到第二行） */
.attach-head { margin-bottom: 8px; font-size: var(--text-caption); color: var(--ink-3); line-height: 1.95; }
.attach-head b { font-size: var(--text-body); color: var(--ink); margin-right: 2px; }
.attach-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px dashed #D9E0EC; }
.attach-row:first-of-type { border-top: none; }
.attach-cat { flex: none; width: 76px; font-size: var(--text-body); color: var(--ink-2); }
.attach-files { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.attach-chip {
  display: inline-flex; align-items: center; max-width: 100%;
  background: #fff; border-radius: var(--radius-control); padding-right: 2px;
  box-shadow: var(--shadow-card-strong);
}
.attach-chip > a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: var(--text-body); color: var(--ink); max-width: 360px; }
.attach-chip > a svg { flex: none; opacity: .6; }
.attach-chip > a:hover { color: var(--brand-dark); text-decoration: underline; }
.attach-chip > a:hover svg { opacity: 1; }
.attach-chip .attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .attach-size { flex: none; font-size: var(--text-caption); color: var(--ink-3); }
.attach-del {
  flex: none; border: none; background: transparent; color: var(--ink-3);
  cursor: pointer; font-size: var(--text-caption); line-height: 1; padding: 5px 6px; border-radius: var(--radius-xs);
}
.attach-del:hover { background: #F1F3F7; color: var(--danger); }
/* 拖拽文件到某一类上时，把那一行点亮，让人知道会存到哪儿 */
.attach-row.over {
  background: #E3E9F5;
  border-radius: var(--radius-control);
  outline: 2px dashed var(--brand);
  outline-offset: -3px;
}
/* 上传进度：文件名 + 百分比 + 一条进度条 */
.attach-progress { margin-top: 12px; border-top: 1px dashed #D9E0EC; padding-top: 10px; }
.attach-progress .ap-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: var(--text-caption); color: var(--ink-2); margin-bottom: 6px;
}
.attach-progress .ap-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-progress .ap-pct { flex: none; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.attach-progress .ap-bar { height: 6px; border-radius: 3px; background: #fff; overflow: hidden; }
.attach-progress .ap-bar > i {
  display: block; height: 100%; width: 0; background: var(--brand); border-radius: 3px;
  transition: width .12s linear;
}
.attach-progress .ap-note { font-size: var(--text-caption); color: var(--ink-3); margin-top: 6px; }

.icon-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: var(--text-heading); color: var(--ink-3); line-height: 1;
  padding: 5px 9px; border-radius: var(--radius-xs);
}
.icon-btn:hover { background: #F1F3F7; color: var(--ink); }

/* -------------------------------- 提示 -------------------------------- */

#toasts { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 9px; }

.toast {
  background: var(--brand); color: #fff; padding: 12px 17px; border-radius: var(--radius-control);
  font-size: var(--text-body); box-shadow: var(--shadow-lg);
  animation: slidein .2s ease;
  max-width: 400px;
  line-height: 1.6;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

@keyframes slidein { from { opacity: 0; transform: translateX(22px) } to { opacity: 1; transform: none } }

.notice {
  padding: 13px 16px;
  border-radius: var(--radius-inner);
  font-size: var(--text-body);
  line-height: 1.8;
  margin-bottom: 14px;
}
.notice.warn { background: var(--warn-soft); color: #8A5A13; }
.notice.info { background: var(--brand-soft); color: var(--ink); }
.notice.err { background: var(--danger-soft); color: #8F2733; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
/* 首页邮件失败提醒：右侧「已读」，点过后当天不再重复提醒 */
.mail-fail-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.mail-fail-notice > div { min-width: 0; }
.mail-fail-notice .btn { flex: none; }
@media (max-width: 560px) {
  .mail-fail-notice { flex-direction: column; align-items: stretch; }
}

.empty { padding: 46px 20px; text-align: center; color: var(--ink-3); font-size: var(--text-body); line-height: 1.9; }
.empty .big { font-size: var(--text-metric); margin-bottom: 12px; opacity: .35; }
.empty .big svg { margin: 0 auto; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(20, 33, 61, .18); border-top-color: var(--brand);
  animation: spin .7s linear infinite; display: inline-block;
}
.btn .spinner { border-color: rgba(255, 255, 255, .4); border-top-color: #fff; }
.btn.ghost .spinner, .btn.outline .spinner { border-color: rgba(20, 33, 61, .18); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg) } }

/* -------------------------------- 日历 -------------------------------- */

.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.cal-head div {
  padding: 11px 9px;
  text-align: center;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--ink-2);
  background: #F8FAFC;
  border-bottom: 1px solid var(--line);
}

.cal-grid .cell {
  min-height: 100px;
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  padding: 9px;
  font-size: var(--text-body);
  position: relative;
}
.cal-grid .cell:nth-child(7n) { border-right: none; }
.cal-grid .cell.out { background: #FAFBFC; color: #C2C8D2; }
.cal-grid .cell.today { background: #F7F8FB; }
.cal-grid .cell .d { font-weight: 500; color: var(--ink-2); margin-bottom: 6px; font-size: var(--text-body); }
.cal-grid .cell.today .d { color: var(--ink); font-weight: 600; }

.cal-grid .item {
  display: block;
  font-size: var(--text-caption);
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  margin-bottom: 3px;
  background: var(--brand-soft);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-grid .item:hover { background: var(--brand-soft-2); }
.cal-grid .item.overdue { background: var(--danger-soft); color: var(--danger); }
.cal-grid .item.paid { background: var(--ok-soft); color: var(--ok); }

/* -------------------------------- 图表 -------------------------------- */

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 168px;
  padding: 8px 2px 0;
}
.mini-chart .col {
  flex: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  justify-items: center;
  height: 100%;
  color: var(--ink-3);
}
.mini-chart .col i {
  width: 100%;
  max-width: 28px;
  display: block;
  align-self: end;
  background: #D9DFEA;
  border-radius: 6px 6px 2px 2px;
  min-height: 3px;
  transition: background .15s;
}
.mini-chart .col:hover i { background: #C3CBD9; }
.mini-chart .col i.on { background: var(--brand); }
.mini-chart .col:hover i.on { background: var(--brand-dark); }
.mini-chart .col span { font-size: var(--text-caption); color: var(--ink-3); white-space: nowrap; }
/* 可点：点某个月 → 下面切成该月还款计划 */
.mini-chart .col { cursor: pointer; }
.mini-chart .col.sel i { background: var(--brand); }
.mini-chart .col.sel span { color: var(--brand); font-weight: 600; }

/* -------------------------------- 其它 -------------------------------- */

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1080px) { .row2 { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: var(--text-body); }
.switch b { font-weight: 600; }

/* 明细表上方的小工具条（期数统计 + 收起已还的开关） */
.table-tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 0 2px 10px;
  font-size: var(--text-body);
}
/* 已还的期数收起后占的那一行 */
tr.paid-fold td {
  background: #FAFBFC; color: var(--ink-3); font-size: var(--text-body);
  text-align: center; padding: 10px; cursor: pointer;
}
tr.paid-fold:hover td { background: #F1F3F7; color: var(--ink); }

.sched-filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.sched-filter-chip {
  height: 30px;
  padding: 0 9px;
  border: 1px solid #E2E6EC;
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-caption);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.sched-filter-chip b {
  margin-left: 3px;
  color: var(--ink-3);
  font-weight: 500;
}
.sched-filter-chip:hover { border-color: #C9D1DE; color: var(--ink); }
.sched-filter-chip.active {
  border-color: #C7D0E0;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.sched-filter-chip.active b { color: var(--brand); font-weight: 600; }
.sched-filter-chip.attention {
  border-color: #E8CDD1;
  background: var(--danger-soft);
  color: var(--danger);
}
.sched-filter-chip.attention b { color: var(--danger); }
.sched-filter-chip.attention.active {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.sched-filter-chip.attention.active b { color: #fff; }
.sched-filter-chip.history {
  border-color: #E7EAF0;
  background: #FAFBFC;
  color: var(--ink-3);
}
.sched-filter-chip.history.active {
  border-color: #D7DCE5;
  background: #F1F3F7;
  color: var(--ink-2);
}
.sched-filter-chip.utility {
  border-color: #E7EAF0;
  background: #FAFBFC;
  color: var(--ink-3);
}
.sched-filter-chip.utility.active {
  border-color: #D7DCE5;
  background: #F1F3F7;
  color: var(--ink-2);
}
.sched-filter-more { position: relative; flex: none; }
.sched-filter-more-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  user-select: none;
}
.sched-filter-more-summary::-webkit-details-marker { display: none; }
.sched-filter-more.is-active > .sched-filter-more-summary {
  border-color: #C7D0E0;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.filter-caret {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s ease;
}
.sched-filter-more[open] .filter-caret { transform: translateY(1px) rotate(225deg); }
.sched-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  width: 158px;
  padding: 5px;
  border-radius: var(--radius-inner);
  background: #fff;
  box-shadow: var(--shadow-overlay);
}
.sched-filter-menu .sched-filter-chip {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: transparent;
  background: transparent;
}
.sched-filter-menu .sched-filter-chip:hover { background: #F5F7FA; }
.sched-filter-menu .sched-filter-chip.active {
  border-color: transparent;
  background: var(--brand-soft);
}

.account-name {
  margin-bottom: 4px;
  color: var(--ink-2);
  font-size: var(--text-caption);
  font-weight: 600;
  white-space: nowrap;
}

/* 弹窗密码框：统一使用右侧文字按钮，隐藏浏览器自带的时隐时现小眼睛 */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
.password-input-wrap { position: relative; }
.password-input-wrap input { padding-right: 62px; }
.password-input-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-caption);
  cursor: pointer;
}
.password-input-toggle:hover { color: var(--brand); background: rgba(20, 33, 61, .05); }

.help { font-size: var(--text-body); color: var(--ink-3); line-height: 1.8; margin-top: 6px; }

/* 编辑弹框里跟普通字段区分开的一段（比如「改还款方式」） */
.edit-sep { border-top: 1px solid var(--line-2); margin: 6px 0 16px; padding-top: 16px; }
.edit-sep .help { margin-bottom: 0; }

/* 「改还款方式」里逐期编辑的还款计划表 */
.plan-editor { margin-top: 14px; }
/* 计划表不再自己滚动（原来是"弹窗滚 + 小框也滚"的双层滚动条）：
   整表展开、跟着弹窗一起滚，表头钉在弹窗顶部，往下一路都看得见列头 */
.plan-table { width: 100%; border-collapse: collapse; font-size: var(--text-body); }
.plan-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: var(--text-body);
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
  background: var(--brand-soft);
  position: sticky;
  top: 0;
  z-index: 2;
}
.plan-table td { padding: 6px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.plan-table tr:last-child td { border-bottom: none; }
.plan-table input { padding: 7px 9px; font-size: var(--text-body); }
.plan-table .icon-btn { font-size: var(--text-body); padding: 4px 7px; }
.plan-tools { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.plan-tools .muted { font-size: var(--text-caption); }
.plan-foot { font-size: var(--text-body); color: var(--ink-2); margin-top: 8px; line-height: 1.8; }

input:disabled, select:disabled, textarea:disabled {
  background: #F7F8FA;
  color: var(--ink-3);
  cursor: not-allowed;
}

code.inline {
  background: #F1F3F7;
  padding: 1.5px 6px;
  border-radius: var(--radius-xs);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: var(--text-body);
  color: var(--ink);
}

.muted { color: var(--ink-3); }

/* ------------------ 系统设置：使用说明（分节排版） ------------------ */
.usage { font-size: var(--text-body); line-height: 1.85; color: var(--ink-2); }
.usage section + section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}
.usage h4 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--ink);
}
.usage h4 .idx {
  flex: none;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--text-caption);
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.usage ul { margin: 0; padding-left: 20px; }
.usage li { margin-bottom: 4px; }
.usage li:last-child { margin-bottom: 0; }
.usage b { color: var(--ink); font-weight: 600; }
.usage .usage-ref { color: var(--ink-3); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D3D8E2; border-radius: var(--radius-xs); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #BCC4D2; background-clip: content-box; }

@media (max-width: 1180px) {
  .cards.kpis { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .mid { grid-template-columns: minmax(0, 1fr); }
  .mid > .card:first-child { grid-column: auto; }
}

@media (max-width: 1050px) {
  .brand-assets-grid { grid-template-columns: 1fr; }
  .brand-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--side-w) - 12px);
    z-index: 60;
    width: var(--side-w);
    background: var(--side-bg);
    box-shadow: var(--shadow-overlay);
    transition: left .2s;
  }
  .sidebar.open { left: 0; }
  .page-head { padding: 18px 22px; }
  .view { padding: 20px 18px 60px; }
  /* 窄屏下金额一行放不下就换行，别把数字拆成两截 */
  .cards, .cards.kpis { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .only-narrow { display: inline-flex; }
  .brand-info-grid { grid-template-columns: 1fr; }
  .brand-info-grid .field.full { grid-column: auto; }
  .brand-save-bar { align-items: stretch; flex-direction: column; }
  .brand-save-bar .btn { align-self: flex-end; }
}

@media (max-width: 480px) {
  .cards, .cards.kpis { grid-template-columns: minmax(0, 1fr); }
  .page-head {
    min-height: 114px;
    padding: 18px 18px 16px;
    align-content: flex-end;
    row-gap: 8px;
  }
  .page-head .head-side {
    flex-basis: 100%;
    justify-content: flex-end;
  }
  .page-head h1 { font-size: var(--text-title); }
  .page-head .lead { font-size: var(--text-body); }
}
