/* ===== iOS 27 毛玻璃设计系统 ===== */
:root {
  /* 背景 */
  --bg-gradient-1: #e6edf9;
  --bg-gradient-2: #f0f4fa;
  --bg-gradient-3: #eaf0ff;

  /* 毛玻璃 */
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
  --glass-shadow-sm: 0 2px 12px rgba(31, 38, 135, 0.05);

  /* 主色 */
  --primary: #4a7dff;
  --primary-light: rgba(74, 125, 255, 0.12);
  --primary-dark: #3a6ae8;

  /* 语义色 */
  --success: #34c759;
  --success-light: rgba(52, 199, 89, 0.12);
  --danger: #ff3b30;
  --danger-light: rgba(255, 59, 48, 0.1);
  --warning: #ff9500;
  --warning-light: rgba(255, 149, 0, 0.12);
  --purple: #af52de;
  --teal: #5ac8fa;
  --pink: #ff2d55;

  /* 状态色 */
  --status-paid: #c7c7cc;
  --status-sub: #4a7dff;
  --status-unpaid: #ff9500;

  /* 文字 */
  --text-primary: #1c1c1e;
  --text-secondary: #636366;
  --text-tertiary: #aeaeb2;
  --text-quaternary: #d1d1d6;

  /* 输入 */
  --input-bg: rgba(120, 120, 128, 0.08);
  --input-border: rgba(120, 120, 128, 0.12);

  /* 圆角 */
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ===== Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 45%, var(--bg-gradient-3) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* 背景装饰色斑 */
body::before {
  content: '';
  position: fixed;
  top: -15%;
  right: -8%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(74, 125, 255, 0.1) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -10%;
  left: -5%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(175, 82, 222, 0.07) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  border: 1px solid rgba(120, 120, 128, 0.15);
  outline: none;
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  width: 100%;
  transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

input::placeholder, textarea::placeholder {
  color: var(--text-tertiary);
}

/* ===== 视图 ===== */
.view {
  display: none;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.view.active {
  display: block;
}

/* ===== 毛玻璃卡片基类 ===== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
}

.glass-card-inner {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
}

/* ===== 登录页 ===== */
#login-view {
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0a1628 0%, #132744 40%, #0f1e35 70%, #0a1628 100%);
}

#login-view::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(74, 125, 255, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

#login-view::after {
  content: '';
  position: absolute;
  bottom: -25%;
  right: -15%;
  width: 55%;
  height: 55%;
  background: radial-gradient(circle, rgba(90, 200, 250, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

#login-view.active {
  display: flex;
  flex-direction: column;
}

#login-view .footer-copyright {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  padding: 0;
  z-index: 1;
}

.login-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  padding: 44px 36px 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, #6b9aff 100%);
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(74, 125, 255, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.login-logo svg {
  width: 36px;
  height: 36px;
}

.login-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 36px;
  letter-spacing: -0.5px;
  color: #fff;
}

.login-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 30px;
}

.login-input-group {
  position: relative;
  margin-bottom: 16px;
  text-align: left;
}

.login-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-input-group input {
  font-size: 16px;
  padding: 13px 16px;
  background: #ffffff;
  border: 1px solid rgba(120, 120, 128, 0.15);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
  text-align: left;
  font-weight: 500;
}

.login-locked {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
  line-height: 1.5;
  font-weight: 500;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #5b8dff 100%);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(74, 125, 255, 0.3);
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(74, 125, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  border: 1px solid rgba(120, 120, 128, 0.15);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn-secondary:hover {
  background: #fff;
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.98);
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.btn-primary:disabled {
  background: var(--text-quaternary);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ===== 主容器 ===== */
.app-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 28px 48px;
}

/* ===== 分段选择器（大圆角） ===== */
.segment-control {
  display: flex;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 4px;
  margin: 24px 0 20px;
  position: relative;
  box-shadow: var(--glass-shadow-sm);
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.segment-control .segment-btn {
  flex: 1;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.segment-control .segment-btn.active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ===== 统计大卡片 ===== */
.stats-card {
  padding: 18px;
  margin-bottom: 20px;
}

.stats-card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 18px;
  letter-spacing: 0.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* 贷款统计子卡片 - 绿色 */
.stat-loan {
  padding: 22px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #34c759 0%, #30b350 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.25);
}

.stat-loan::before {
  display: none;
}

.stat-loan .stat-title { color: rgba(255,255,255,0.85); }
.stat-loan .stat-title .dot { background: rgba(255,255,255,0.9); }
.stat-loan .stat-percent {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.stat-loan .stat-big-number { color: #fff; }
.stat-loan .stat-big-number .currency { color: rgba(255,255,255,0.7); }
.stat-loan .stat-big-label { color: rgba(255,255,255,0.65); }
.stat-loan .progress-bar { background: rgba(255,255,255,0.2); }
.stat-loan .progress-fill.loan { background: #fff; }
.stat-loan .progress-detail-item .label { color: rgba(255,255,255,0.6); }
.stat-loan .progress-detail-item .value { color: #fff; }
.stat-loan .progress-detail-item .value.paid { color: rgba(255,255,255,0.9); }
.stat-loan .progress-detail-item .value.unpaid { color: rgba(255,255,255,0.9); }
.stat-loan .progress-detail-item .value.total { color: #fff; }

/* 订阅统计子卡片 - 蓝色 */
.stat-sub {
  padding: 22px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #4a7dff 0%, #3a6ae8 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(74, 125, 255, 0.25);
}

.stat-sub::before {
  display: none;
}

.stat-sub .stat-title { color: rgba(255,255,255,0.85); }
.stat-sub .stat-title .dot { background: rgba(255,255,255,0.9); }
.stat-sub .sub-amount { color: #fff; }
.stat-sub .sub-amount .currency { color: rgba(255,255,255,0.7); }
.stat-sub .sub-amount.usd { color: rgba(255,255,255,0.8); }
.stat-sub .stat-big-label { color: rgba(255,255,255,0.65); }
.stat-sub .sub-breakdown-row {
  background: rgba(255,255,255,0.15);
}
.stat-sub .sub-breakdown-row .label { color: rgba(255,255,255,0.8); }
.stat-sub .sub-breakdown-row .label .flag.rmb { background: rgba(255,255,255,0.25); color: #fff; }
.stat-sub .sub-breakdown-row .label .flag.usd { background: rgba(255,255,255,0.25); color: #fff; }
.stat-sub .sub-breakdown-row .value { color: #fff; }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
  letter-spacing: 1px;
}

.stat-title .dot {
  display: none;
}

.stat-percent {
  display: none;
}

/* 大数字 */
.stat-big-number {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-align: center;
}

.stat-big-number .currency {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin-right: 2px;
}

.stat-big-label {
  font-size: 20px;
  color: rgba(255,255,255,0.65);
  margin-bottom: 14px;
  margin-top: 6px;
  font-weight: 600;
  text-align: center;
}

/* 进度条 */
.progress-bar {
  height: 12px;
  background: rgba(120, 120, 128, 0.1);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.loan {
  background: linear-gradient(90deg, var(--primary), #6b9aff);
}

/* 进度明细 */
.progress-detail {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.progress-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-detail-item .label {
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 500;
}

.progress-detail-item .value {
  font-weight: 800;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.progress-detail-item .value.paid { color: var(--success); }
.progress-detail-item .value.unpaid { color: var(--danger); }
.progress-detail-item .value.total { color: var(--text-primary); }

.sub-amount-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.sub-amount {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.sub-amount .currency {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sub-amount.usd {
  font-size: 20px;
  color: var(--text-secondary);
}

.sub-breakdown {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.sub-breakdown-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
}

.sub-breakdown-row .label {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-breakdown-row .label .flag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.sub-breakdown-row .label .flag.rmb { background: rgba(255,255,255,0.25); color: #fff; }
.sub-breakdown-row .label .flag.usd { background: rgba(255,255,255,0.25); color: #fff; }

.sub-breakdown-row .value {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

/* ===== 月视图大卡片 ===== */
.month-card {
  padding: 24px;
}

/* 月份导航 */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.month-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.month-nav-btn:hover {
  color: var(--primary);
  background: #fff;
  transform: scale(1.05);
}

.month-nav-btn:active {
  transform: scale(0.95);
}

.month-nav-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.month-picker-wrap {
  flex: 1;
  text-align: center;
}

.month-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: 10px 22px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  letter-spacing: -0.3px;
}

.month-picker:hover {
  background: #fff;
}

.month-picker svg {
  width: 14px;
  height: 14px;
  fill: var(--text-tertiary);
}

.month-picker input[type="month"],
.month-picker-wrap input[type="month"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ===== 自定义月份选择器 ===== */
.month-picker-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
}

.month-picker-modal.active {
  display: flex;
}

.month-picker-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
  animation: mpFadeIn 0.2s ease;
}

@keyframes mpFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.mp-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.mp-year-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(120, 120, 128, 0.08);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 18px;
  font-weight: 600;
}

.mp-year-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.mp-year-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.mp-year-input {
  width: 110px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(120, 120, 128, 0.06);
  color: var(--text-primary);
  transition: all 0.2s;
  -moz-appearance: textfield;
}

.mp-year-input::-webkit-outer-spin-button,
.mp-year-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mp-year-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.mp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mp-month-btn {
  padding: 12px 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(120, 120, 128, 0.06);
  border-radius: 10px;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.mp-month-btn:hover {
  background: rgba(120, 120, 128, 0.12);
  transform: translateY(-1px);
}

.mp-month-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(74, 125, 255, 0.35);
}

.mp-footer {
  margin-top: 16px;
  text-align: center;
}

.mp-today-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 20px;
  border-radius: 8px;
  transition: all 0.2s;
}

.mp-today-btn:hover {
  background: var(--primary-light);
}

/* 月视图汇总条 */
.month-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
  margin-top: 20px;
  margin-bottom: 20px;
}

.month-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.month-summary-item .num {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.month-summary-item .num.pending { color: var(--warning); }
.month-summary-item .num.done { color: var(--success); }
.month-summary-item .num.total { color: var(--text-primary); }

.month-summary-item .label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.month-summary-divider {
  width: 1px;
  height: 28px;
  background: var(--text-quaternary);
}

/* ===== 还款项目网格（响应式 4-3-2-1） ===== */
.repay-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* 项目卡片 */
.repay-item-card {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  transition: all 0.25s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  height: 138px;
  cursor: pointer;
}

.repay-item-card:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.repay-item-card.paid {
  opacity: 0.55;
}

.repay-item-card.paid .repay-name,
.repay-item-card.paid .repay-amount {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

/* 第一列：日期+星期 */
.repay-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  padding-right: 14px;
  border-right: 1px solid var(--text-quaternary);
  height: 100%;
  justify-content: center;
}

.repay-date .day {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.repay-date .weekday {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-top: 4px;
}

.repay-date.today .day {
  color: var(--primary);
}

.repay-date.today .weekday {
  color: var(--primary);
}

/* 第二列：状态色点 */
.repay-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.repay-status-dot.paid { background: var(--status-paid); }
.repay-status-dot.sub { background: var(--status-sub); }
.repay-status-dot.unpaid { background: var(--status-unpaid); }

/* 第三列：简称+备注 */
.repay-info {
  min-width: 0;
}

.repay-name {
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}

.repay-period {
  font-size: 13px;
  font-weight: 400;
  color: #1a3a6b;
  margin-top: 4px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repay-meta {
  font-size: 16px;
  color: var(--text-tertiary);
  margin-top: 8px;
  line-height: 1.6;
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cancel-tag {
  display: inline-block;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

/* 第四列：金额 */
.repay-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.repay-amount .currency-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}

.repay-amount .amount-num {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 第五列：复选框 */
.checkbox {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--text-quaternary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
}

.checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.35);
}

.checkbox.checked svg {
  opacity: 1;
  transform: scale(1);
}

.checkbox svg {
  width: 14px;
  height: 14px;
  fill: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.25s;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  fill: var(--text-quaternary);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* ===== 设置页 ===== */
.settings-section {
  padding: 20px;
  margin-bottom: 16px;
}

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(120, 120, 128, 0.1);
}

.settings-section-title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

.settings-section-title .icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-section-title .icon svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.icon.blue { background: linear-gradient(135deg, var(--primary), #6b9aff); }
.icon.green { background: linear-gradient(135deg, var(--success), #5dd879); }
.icon.orange { background: linear-gradient(135deg, var(--warning), #ffb340); }

.btn-add {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--primary), #5b8dff);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(74, 125, 255, 0.25);
}

.btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 125, 255, 0.35);
}

.btn-add svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* 系统设置行 */
.system-settings-row {
  display: flex;
  align-items: center;
  padding: 14px 0;
  gap: 14px;
}

.system-settings-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 80px;
  flex-shrink: 0;
}

.system-settings-input-wrap {
  flex: 1;
}

.system-settings-input-wrap input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(120, 120, 128, 0.2);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

.system-settings-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 125, 255, 0.1);
}

.btn-save-settings {
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-save-settings:hover {
  background: #3a6be6;
  transform: translateY(-1px);
}

/* 密码行 */
.password-row {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(120, 120, 128, 0.08);
  gap: 14px;
}

.password-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.password-row:first-child {
  padding-top: 0;
}

.password-role {
  flex-shrink: 0;
  width: 80px;
}

.password-role-name {
  font-size: 15px;
  font-weight: 700;
}

.password-role-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  display: inline-block;
  margin-top: 3px;
  letter-spacing: 0.3px;
}

.password-role-badge.admin { background: var(--primary-light); color: var(--primary); }
.password-role-badge.viewer { background: var(--success-light); color: var(--success); }

.password-fields {
  flex: 1;
  display: flex;
  gap: 8px;
}

.password-fields input {
  flex: 1;
  font-size: 13px;
  padding: 9px 12px;
}

.btn-change-pwd {
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--primary), #5b8dff);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(74, 125, 255, 0.25);
}

.btn-change-pwd:hover {
  transform: translateY(-1px);
}

/* 管理列表项 */
.manage-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(120, 120, 128, 0.08);
  gap: 14px;
}

.manage-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

#loan-manage-list,
#sub-manage-list {
  padding-left: 40px;
}

.manage-item:first-child {
  padding-top: 0;
}

.manage-item-color {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.manage-item-info {
  flex: 1;
  min-width: 0;
}

.manage-item-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manage-item-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.manage-item-amount {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.btn-delete {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.btn-delete svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
}

.modal.modal-wide {
  max-width: 1200px;
}

.loan-form-layout {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.loan-form-left {
  flex: 1.4;
  min-width: 0;
}

.loan-form-left .form-row {
  grid-template-columns: 1fr 1fr 1fr;
}

.loan-form-right {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.loan-form-right .form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.loan-form-right .monthly-breakdown {
  max-height: none;
  flex: 1;
  min-height: 480px;
}

.loan-form-right .monthly-breakdown-item .month-amount-input {
  flex: 0 0 50%;
  width: 50%;
  margin-left: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(120, 120, 128, 0.1);
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  background: rgba(120, 120, 128, 0.08);
}

.modal-close:hover {
  background: rgba(120, 120, 128, 0.15);
  color: var(--text-primary);
}

.modal-close svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid rgba(120, 120, 128, 0.1);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn-cancel {
  flex: 1;
  padding: 13px;
  background: rgba(120, 120, 128, 0.1);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: rgba(120, 120, 128, 0.18);
}

.btn-submit {
  flex: 2;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary), #5b8dff);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(74, 125, 255, 0.3);
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(74, 125, 255, 0.4);
}

/* 表单 */
.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 5px;
}

/* 切换器 */
.switch-segment {
  display: flex;
  background: rgba(120, 120, 128, 0.1);
  border-radius: 10px;
  padding: 3px;
}

.switch-segment button {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.25s;
  height: 39px;
  line-height: 1;
}

.switch-segment button.active {
  background: #fff;
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* 币种切换 */
.currency-switch {
  display: flex;
  background: rgba(120, 120, 128, 0.1);
  border-radius: 10px;
  padding: 3px;
}

.currency-switch button {
  flex: 1;
  padding: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.25s;
}

.currency-switch button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* 计费周期切换 */
.billing-switch {
  display: flex;
  background: rgba(120, 120, 128, 0.1);
  border-radius: 10px;
  padding: 3px;
}

.billing-switch button {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.25s;
}

.billing-switch button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* 禁用状态 */
input:disabled {
  background: rgba(120, 120, 128, 0.08) !important;
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* 每月还款明细 */
.monthly-breakdown {
  background: rgba(120, 120, 128, 0.06);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  max-height: 450px;
  overflow-y: auto;
}

.monthly-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(120, 120, 128, 0.08);
  gap: 12px;
}

.monthly-breakdown-item:last-child {
  border-bottom: none;
}

.monthly-breakdown-item .month-label {
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 52px;
}

.monthly-breakdown-item .month-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.monthly-amount-input {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(120, 120, 128, 0.12);
  border-radius: 6px;
  color: var(--text-primary);
  transition: all 0.2s;
}

.monthly-amount-input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* 附件上传 */
.upload-area {
  border: 2px dashed rgba(120, 120, 128, 0.2);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.3);
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area svg {
  width: 30px;
  height: 30px;
  fill: var(--text-tertiary);
  margin-bottom: 8px;
}

.upload-area p {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.upload-area .upload-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.uploaded-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.uploaded-file {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  max-width: 100%;
}

.uploaded-file .file-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  font-weight: 500;
}

.uploaded-file .file-remove {
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.uploaded-file .file-remove:hover {
  color: var(--danger);
}

/* 颜色选择器 */
.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.color-dot:hover {
  transform: scale(1.1);
}

.color-dot.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--primary), 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 详情弹窗 - 只读信息 */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(120, 120, 128, 0.08);
  gap: 16px;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row .detail-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 90px;
}

.detail-row .detail-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.detail-row .detail-value.muted {
  color: var(--text-tertiary);
  font-weight: 500;
}

.detail-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}

.detail-attachments {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(120, 120, 128, 0.06);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.detail-attachment-item:hover {
  background: var(--primary-light);
}

.detail-attachment-item svg {
  width: 18px;
  height: 18px;
  fill: var(--primary);
  flex-shrink: 0;
}

.detail-attachment-item .att-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-attachment-item .att-size {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* 版权信息 */
.footer-copyright {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 20px 0 28px;
  letter-spacing: 0.3px;
}

/* 可见性开关行 */
.visibility-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

/* iOS 风格开关 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 30px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(120, 120, 128, 0.2);
  transition: 0.3s;
  border-radius: 30px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: rgba(28, 28, 30, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  z-index: 2000;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 90%;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: rgba(52, 199, 89, 0.92); }
.toast.error { background: rgba(255, 59, 48, 0.92); }

/* 图片预览弹窗 */
#image-preview-modal {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 3000;
}

#image-preview-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-container {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.image-preview-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.image-preview-container img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* 附件缩略图 */
.detail-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-attachment-item {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(120, 120, 128, 0.15);
  background: rgba(120, 120, 128, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
}

.detail-attachment-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-attachment-item .pdf-icon {
  width: 48px;
  height: 48px;
  fill: #ff3b30;
}

.detail-attachment-item .att-name-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 10px;
  padding: 3px 6px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 首次改密弹窗 */
.first-login-modal {
  align-items: center;
}

.first-login-modal .modal {
  max-width: 400px;
  border-radius: var(--radius-xl);
  margin: 0 16px;
}

/* ===== 响应式 ===== */

/* 大屏：4列 */
@media (min-width: 1024px) {
  .repay-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 中屏：3列 */
@media (max-width: 1023px) and (min-width: 768px) {
  .repay-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 窄屏（平板竖屏及手机）：1列 */
@media (max-width: 767px) {
  .repay-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .loan-form-left .form-row {
    grid-template-columns: 1fr;
  }

  .loan-form-layout {
    flex-direction: column;
  }

  .loan-form-right {
    width: 100%;
  }

  .loan-form-right .monthly-breakdown {
    min-height: 300px;
  }

  .password-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .password-role {
    width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .password-fields {
    flex-direction: column;
  }

  .login-card {
    padding: 32px 24px;
  }

  .stats-card,
  .month-card,
  .settings-section {
    padding: 18px 16px;
  }

  .stat-big-number {
    font-size: 26px;
  }

  .month-picker {
    font-size: 16px;
    padding: 8px 18px;
  }

  .month-summary {
    gap: 16px;
  }

  .app-container {
    padding: 0 14px 36px;
  }

  /* 手机端项目卡片适配：3列布局，内容上下排列 */
  .repay-item-card {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 170px;
    padding: 14px 14px;
    gap: 8px 12px;
  }

  .repay-date {
    grid-row: 1 / 3;
    min-width: 42px;
    padding-right: 10px;
  }

  .repay-date .day {
    font-size: 24px;
  }

  /* 状态色点：在名称内部 */
  .repay-status-dot {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
  }

  /* 中间信息区：第一行名称、第二行期数、第三行备注 */
  .repay-info {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .repay-name {
    font-size: 17px;
    gap: 6px;
  }

  .repay-period {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .repay-meta {
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.5;
    word-break: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  /* 金额区：第四行货币单位、第五行金额数字 */
  .repay-amount {
    grid-column: 2;
    grid-row: 2;
    align-items: flex-start;
    gap: 2px;
  }

  .repay-amount .currency-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
  }

  .repay-amount .amount-num {
    font-size: 20px;
    font-weight: 800;
  }

  /* 复选框：右侧上下居中 */
  .checkbox {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    width: 28px;
    height: 28px;
  }
}

/* 桌面端弹窗居中 */
@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: var(--radius-xl);
    max-height: 85vh;
  }
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 128, 0.25);
  border-radius: 3px;
}

::-webkit-scrollbar-track {
  background: transparent;
}
