/* Cost tool styles. Ported from the mini program: the home page uses its dark
   hero card, the detail page a light head card. Font sizes are scaled up from
   rpx for desktop readability rather than a straight rpx/2. */

.page-heading {
  font-size: 18px;
  font-weight: 700;
  color: #1f2329;
  margin: 0 0 16px;
}

/* ===== Home hero card (dark) ===== */
.hero-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #1f2329, #374151);
  box-shadow: 0 16px 40px rgba(31, 35, 41, 0.22);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  cursor: pointer;
}

.hero-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-label {
  font-size: 13px;
  line-height: 18px;
  color: rgba(255, 255, 255, 0.6);
}

.hero-switch-icon,
.hero-scope-icon,
.head-switch-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8h14l-4-4'/%3E%3Cpath d='M21 16H7l4 4'/%3E%3C/svg%3E") no-repeat 50% 50%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8h14l-4-4'/%3E%3Cpath d='M21 16H7l4 4'/%3E%3C/svg%3E") no-repeat 50% 50%;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.hero-switch-icon {
  width: 12px;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.42);
}

.hero-scope {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.hero-scope:hover {
  background: rgba(255, 255, 255, 0.22);
}

.hero-scope-label {
  font-size: 13px;
  line-height: 18px;
  color: rgba(255, 255, 255, 0.9);
}

.hero-scope-icon {
  width: 10px;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.65);
}

.hero-value {
  margin-top: 6px;
  font-size: 44px;
  font-weight: 700;
  line-height: 50px;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.hero-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.hero-total {
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

/* ===== Detail head card (light) ===== */
.detail-head {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(31, 35, 41, 0.05);
  padding: 20px;
  margin-bottom: 18px;
  cursor: pointer;
}

.detail-head:hover {
  background: #fbfcfd;
}

.detail-head.is-inactive {
  opacity: 0.72;
}

.head-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.head-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  color: #1f2329;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.head-hero {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f2f3f5;
}

.head-hero-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.head-hero-label {
  font-size: 13px;
  line-height: 18px;
  color: #86909c;
}

.head-switch-icon {
  width: 12px;
  height: 12px;
  background-color: #c9cdd4;
}

.head-hero-value {
  margin-top: 4px;
  min-width: 0;
  font-size: 36px;
  font-weight: 700;
  line-height: 42px;
  color: #1f2329;
  font-variant-numeric: tabular-nums;
}

.head-metrics {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: 14px;
}

.head-metric {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.head-metric-value {
  overflow: hidden;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: #1f2329;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.head-metric-label {
  margin-top: 2px;
  font-size: 12px;
  line-height: 16px;
  color: #86909c;
}

.head-period {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 60%;
}

.head-period-days {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #4e5969;
  font-variant-numeric: tabular-nums;
}

.head-period-range {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  line-height: 16px;
  color: #86909c;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.head-note {
  max-width: 100%;
  margin-top: 10px;
  overflow: hidden;
  font-size: 13px;
  line-height: 18px;
  color: #86909c;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search {
  flex: 1;
  min-width: 200px;
  border: 1px solid #eef0f4;
  background: #ffffff;
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  color: #1f2329;
}

.search:focus {
  outline: none;
  border-color: #cfd6e0;
}

.count-badge {
  flex: none;
  font-size: 13px;
  color: #5f6673;
  background: #eef0f4;
  border-radius: 999px;
  padding: 6px 12px;
}

.sort-row {
  display: flex;
  gap: 8px;
}

.sort-chip {
  border: 1px solid #eef0f4;
  background: #ffffff;
  color: #5f6673;
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.sort-chip.is-active {
  background: #f5f7fb;
  border-color: #dfe3ea;
  color: #1f2329;
}

.badge,
.primary-tag {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: #5f6673;
  background: #eef0f4;
  border-radius: 999px;
  padding: 1px 7px;
}

/* ===== Forms (record edit + detail addition) ===== */
.form-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(31, 35, 41, 0.05);
  padding: 20px;
}

.field {
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 13px;
  color: #5f6673;
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  border: 1px solid #eef0f4;
  background: #ffffff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  color: #1f2329;
}

.field-input:focus {
  outline: none;
  border-color: #cfd6e0;
}

textarea.field-input {
  resize: vertical;
  min-height: 72px;
}

.field-error {
  margin-top: 6px;
  font-size: 13px;
  color: #e5484d;
}

/* 带计数的输入框：右侧留位，避免文字写到计数下面 */
.field:has(.field-note) .field-input {
  padding-right: 56px;
}

/* 计数器叠在框内右下角 */
.field-note {
  position: absolute;
  right: 8px;
  bottom: 6px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  color: #8c93a3;
  pointer-events: none;
}

.field-static {
  font-size: 15px;
  color: #1f2329;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-row .field-label {
  margin-bottom: 0;
}

.date-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .date-pair {
    grid-template-columns: 1fr;
  }
}
