<template>
  <div class="grass-livestock-balance">
    <div class="balance-backdrop" aria-hidden="true">
      <div class="balance-orbit is-left"></div>
      <div class="balance-orbit is-right"></div>
      <div class="balance-energy-band"></div>
    </div>

    <div class="balance-screen">
      <m-card class="balance-card balance-target-card" title="核算对象" :width="selectorCardWidth" :height="selectorCardHeight">
        <div class="balance-selector">
          <div class="balance-scope-tabs">
            <button
              v-for="scope in scopeOptions"
              :key="scope.key"
              type="button"
              :class="{ active: activeScope === scope.key }"
              @click="handleScopeChange(scope.key)"
            >
              {{ scope.name }}
            </button>
          </div>

          <div class="balance-target-list">
            <button
              v-for="item in visibleTargetRows"
              :key="item.key"
              type="button"
              :class="{ active: item.key === activeBalance?.key }"
              :title="item.name"
              @click="selectBalance(item)"
            >
              <span>{{ item.name }}</span>
            </button>
          </div>

          <div class="balance-action-box">
            <span>当前对象</span>
            <strong>{{ activeBalance?.name || "未选择" }}</strong>
            <small>{{ selectedStatusText }}</small>
            <button
              type="button"
              :disabled="!hasSelection || analysisRunning"
              @click="startAnalysis"
            >
              {{ analysisRunning ? "分析中..." : analysisDone ? "重新分析" : "开始分析" }}
            </button>
          </div>
        </div>
      </m-card>

      <m-card class="balance-card balance-sheet-card" :title="sheetTitle" :width="sheetCardWidth" :height="mainCardHeight">
        <div class="balance-sheet" :class="{ 'is-ready': analysisDone, 'is-running': analysisRunning }">
          <div class="balance-field-lines" aria-hidden="true">
            <i></i>
            <i></i>
            <i></i>
          </div>

          <section v-if="analysisRunning" class="balance-running">
            <div class="balance-running-head">
              <div class="balance-core-ring is-running" :style="{ '--usage-angle': `${analysisProgress * 3.6}deg` }">
                <div class="balance-core-inner">
                  <span>分析进度</span>
                  <strong>{{ analysisProgress }}%</strong>
                  <small>{{ currentProcessStep.name }}</small>
                </div>
              </div>

              <div class="balance-running-title">
                <span>{{ activeBalance.name }}</span>
                <strong>{{ currentProcessStep.desc }}</strong>
                <small>{{ currentProcessStep.plan }}</small>
                <div class="balance-progress-line">
                  <i :style="{ width: `${analysisProgress}%` }"></i>
                </div>
              </div>
            </div>

            <div class="balance-live-process">
              <div
                v-for="(step, index) in analysisProcessRows"
                :key="step.key"
                class="balance-live-step"
                :class="`is-${getProcessStepState(index)}`"
              >
                <span>{{ step.index }}</span>
                <div>
                  <strong>{{ step.name }}</strong>
                  <p>{{ shouldRevealProcessStep(index) ? step.plan : step.pending }}</p>
                </div>
              </div>
            </div>
          </section>

          <section v-else-if="!analysisDone" class="balance-waiting">
            <div class="balance-wait-core">
              <div class="balance-core-ring is-empty">
                <div class="balance-core-inner">
                  <span>{{ waitStatus }}</span>
                  <strong>{{ hasSelection ? activeBalance.name : "草畜平衡" }}</strong>
                  <small>{{ hasSelection ? "待执行模型分析" : "等待核算对象" }}</small>
                </div>
              </div>
              <h2>{{ waitTitle }}</h2>
              <p>{{ waitDescription }}</p>
            </div>

            <div class="balance-preflight">
              <span :class="{ active: hasSelection }">对象锁定</span>
              <i></i>
              <span :class="{ active: hasSelection }">等待启动分析</span>
              <i></i>
              <span>生成过程与结论</span>
            </div>
          </section>

          <section v-else class="balance-analysis">
            <div class="balance-dashboard">
              <div class="balance-object-block">
                <span>{{ scopeLabel }}核算对象</span>
                <strong>{{ activeBalance.name }}</strong>
                <small>{{ subjectMeta }}</small>
              </div>

              <div class="balance-core">
                <div class="balance-core-ring" :style="{ '--usage-angle': usageAngle }">
                  <div class="balance-core-inner">
                    <span>承载利用率</span>
                    <strong>{{ formatPercent(activeDerived.usageRate) }}</strong>
                    <small>超载率 {{ formatPercent(activeDerived.overloadRate) }}</small>
                  </div>
                </div>
                <div class="balance-core-caption">草地承载力模型</div>
              </div>

              <div class="balance-verdict-card" :class="`is-${activeDerived.risk.key}`">
                <span>分析结论</span>
                <strong>{{ activeDerived.risk.label }}</strong>
                <small>{{ verdictHint }}</small>
              </div>
            </div>

            <div class="balance-compare">
              <div class="balance-bar-row">
                <span>理论承载力</span>
                <div><i :style="{ width: `${activeDerived.bearingPercent}%` }"></i></div>
                <strong>{{ formatNumber(activeDerived.bearing) }}</strong>
              </div>
              <div class="balance-bar-row is-livestock">
                <span>实际载畜量</span>
                <div><i :style="{ width: `${activeDerived.livestockPercent}%` }"></i></div>
                <strong>{{ formatNumber(activeDerived.livestock) }}</strong>
              </div>
            </div>

            <div class="balance-detail">
              <div class="balance-process">
                <div class="balance-section-title">
                  <span>分析过程</span>
                  <small>{{ activeBalance.year || "当前年度" }}</small>
                </div>

                <div class="balance-process-track">
                  <span
                    v-for="step in workflowRows"
                    :key="`track-${step.key}`"
                    :class="`is-${step.state}`"
                  >
                    {{ step.name }}
                  </span>
                </div>

                <div
                  v-for="step in calculationSteps"
                  :key="step.key"
                  class="balance-formula-row"
                >
                  <span>{{ step.index }}</span>
                  <div>
                    <strong>{{ step.name }}</strong>
                    <p>{{ step.desc }}</p>
                  </div>
                </div>
              </div>

              <div class="balance-decision">
                <div class="balance-section-title">
                  <span>结论与建议</span>
                  <small>{{ decisionHint }}</small>
                </div>
                <div class="balance-conclusion">
                  <strong>{{ activeDerived.risk.description }}</strong>
                  <p>{{ conclusionSummary }}</p>
                </div>
                <div class="balance-advice-list">
                  <div
                    v-for="(item, index) in activeAdviceRows"
                    :key="`${item}-${index}`"
                    class="balance-advice-item"
                  >
                    <span>{{ index + 1 }}</span>
                    <p>{{ item }}</p>
                  </div>
                </div>
              </div>
            </div>
          </section>
        </div>
      </m-card>
    </div>
  </div>
</template>

<script setup>
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue"
import mCard from "@/components/mCard/index.vue"
import { getAreaChildren, getBalanceAdvice } from "@/services/balanceApi"
import {
  BALANCE_CALCULATION_PARAMS,
  balanceFallbackRows,
  buildBalanceRow,
  deriveBalance,
  formatNumber,
  formatPercent,
  normalizeBalanceResult,
  pickValue,
  splitAdvice,
  toNumber,
} from "./data"

const props = defineProps({
  active: {
    type: Boolean,
    default: true,
  },
})
const emit = defineEmits(["loading-progress", "map-ready"])

const selectorCardWidth = 326
const sheetCardWidth = 1310
const screenViewportHeight = ref(typeof window === "undefined" ? 1080 : window.innerHeight)
const balanceScreenTop = 128
const balanceScreenBottomGap = 8
const mainCardHeight = computed(() => {
  const viewportHeight = Math.max(1080, Number(screenViewportHeight.value) || 1080)
  return Math.max(944, viewportHeight - balanceScreenTop - balanceScreenBottomGap)
})
const selectorCardHeight = computed(() => Math.max(844, mainCardHeight.value - 100))
const MIN_ANALYSIS_DURATION = 6200

const activeScope = ref("county")
const activeKey = ref("")
const analysisState = ref("idle")
const analysisProgress = ref(0)
const processStageIndex = ref(0)
const analysisError = ref("")
const apiResults = ref({})
const villageTargetRows = ref([])
let destroyed = false
let requestSerial = 0
let analysisTimer = null
let villageLoadSerial = 0
let activeAnalysisRequest = null

const balanceRows = computed(() =>
  [
    ...balanceFallbackRows,
    ...villageTargetRows.value,
  ].map((row) => normalizeBalanceResult(apiResults.value[row.key], row))
)
const countyRows = computed(() => balanceRows.value.filter((item) => item.type === "county"))
const townRows = computed(() => balanceRows.value.filter((item) => item.type === "town"))
const villageRows = computed(() => balanceRows.value.filter((item) => item.type === "village"))
const visibleTargetRows = computed(() => {
  if (activeScope.value === "town") return townRows.value
  if (activeScope.value === "village") return villageRows.value
  return countyRows.value
})
const activeBalance = computed(() => balanceRows.value.find((item) => item.key === activeKey.value) || null)
const hasSelection = computed(() => Boolean(activeBalance.value))
const analysisRunning = computed(() => analysisState.value === "running")
const analysisDone = computed(() => hasSelection.value && analysisState.value === "done")
const activeDerived = computed(() => deriveBalance(activeBalance.value || {}))
const scopeOptions = computed(() => [
  { key: "county", name: "县" },
  { key: "town", name: "镇" },
  { key: "village", name: "村" },
])
const scopeLabel = computed(() => scopeOptions.value.find((item) => item.key === activeScope.value)?.name || "县")
const subjectMeta = computed(() => {
  if (!activeBalance.value) return "等待选择核算对象"
  if (activeBalance.value.areaCode) return `行政区划 ${activeBalance.value.areaCode}`
  return activeBalance.value.township || "核算对象"
})
const selectedStatusText = computed(() => {
  if (analysisError.value) return analysisError.value
  if (!hasSelection.value) return "请先选择具体对象"
  if (analysisDone.value) return "分析已完成"
  if (analysisRunning.value) return "正在执行核算"
  return "已选择，待开始分析"
})
const sheetTitle = computed(() => analysisDone.value ? "草畜平衡分析舱" : "草畜平衡分析")
const waitStatus = computed(() => {
  if (!hasSelection.value) return "待选择"
  if (analysisRunning.value) return "分析中"
  return "待开始"
})
const waitTitle = computed(() => {
  if (!hasSelection.value) return "先选择一个核算对象"
  if (analysisRunning.value) return `${activeBalance.value.name} 正在分析`
  return `${activeBalance.value.name} 待开始分析`
})
const waitDescription = computed(() => {
  if (analysisError.value) return analysisError.value
  if (!hasSelection.value) return "选择县、镇或村后，系统才会进入草地承载力核算。"
  if (analysisRunning.value) return "正在读取草畜平衡结果，核对承载力、载畜量和超载率。"
  return "点击左侧开始分析后，再展示结果、分析过程、结论和建议。"
})
const conclusionSummary = computed(() => {
  const derived = activeDerived.value
  if (derived.delta === null) return "根据草畜平衡结果表返回的承载力、载畜量和超载率生成判定。"
  const deltaName = derived.delta > 0 ? "超载量" : "承载余量"
  return `${deltaName} ${formatNumber(Math.abs(derived.delta))}，承载利用率 ${formatPercent(derived.usageRate)}。`
})
const verdictHint = computed(() => {
  if (["healthy", "balanced"].includes(activeDerived.value.risk.key)) return "保持监测"
  if (activeDerived.value.risk.key === "watch") return "关注调控"
  if (activeDerived.value.delta === null) return "按结果表判定"
  return activeDerived.value.delta > 0 ? "需调控载畜量" : "承载能力可覆盖"
})
const decisionHint = computed(() => {
  if (["healthy", "balanced"].includes(activeDerived.value.risk.key)) return "保持监测"
  if (activeDerived.value.risk.key === "watch") return "关注调控"
  if (activeDerived.value.delta === null) return "结果表口径"
  return activeDerived.value.delta > 0 ? "需要调控" : "保持监测"
})
const usageAngle = computed(() => {
  const usage = Math.max(0, Math.min(130, Number(activeDerived.value.usageRate) || 0))
  return `${Math.round((usage / 130) * 360)}deg`
})

const calculationSteps = computed(() => [
    {
      key: "productivity",
      index: "01",
      name: "草地生产力核算",
      desc: "核定草地范围、面积和产草量等级，形成生产力基础口径。",
    },
    {
      key: "forage",
      index: "02",
      name: "可利用草量折算",
      desc: "扣除不可食草量、生态保留量和利用限制，折算可供放牧利用草量。",
    },
    {
      key: "livestock",
      index: "03",
      name: "载畜量折算",
      desc: "依据实际存栏和草畜平衡标准，统一形成载畜压力口径。",
    },
    {
      key: "balance",
      index: "04",
      name: "平衡判定",
      desc: "对比草地承载能力与载畜压力，输出平衡状态和调控方案。",
    },
])

const analysisProcessRows = computed(() => {
  const derived = activeDerived.value
  return [
    {
      key: "productivity",
      index: "01",
      name: "草地生产力核算",
      desc: "核算草地面积与产草能力",
      pending: "等待草地参数",
      plan: "核定草地范围、面积和产草量等级",
    },
    {
      key: "forage",
      index: "02",
      name: "可利用草量折算",
      desc: "折算可供放牧利用草量",
      pending: "等待草量折算",
      plan: "扣除不可食草量、生态保留量和利用限制",
    },
    {
      key: "livestock",
      index: "03",
      name: "载畜量折算",
      desc: "形成实际载畜压力口径",
      pending: "等待载畜折算",
      plan: "依据实际存栏和草畜平衡标准进行折算",
    },
    {
      key: "balance",
      index: "04",
      name: "平衡判定",
      desc: "生成结论与调控方向",
      pending: "等待平衡判定",
      plan: ["healthy", "balanced"].includes(derived.risk.key) ? "判定平衡状态并生成监测方案" : "判定超载风险并生成调控方案",
    },
  ]
})
const currentProcessStep = computed(() => analysisProcessRows.value[Math.min(processStageIndex.value, analysisProcessRows.value.length - 1)] || analysisProcessRows.value[0])

const workflowRows = computed(() => [
  {
    key: "productivity",
    index: "01",
    name: "生产力核算",
    desc: analysisDone.value ? "草地生产力核算" : hasSelection.value ? "等待核算" : "等待选择",
    state: hasSelection.value ? "done" : "active",
  },
  {
    key: "forage",
    index: "02",
    name: "草量折算",
    desc: analysisDone.value ? "可利用草量折算" : "分析后折算",
    state: analysisRunning.value ? "active" : analysisDone.value ? "done" : hasSelection.value ? "pending" : "disabled",
  },
  {
    key: "livestock",
    index: "03",
    name: "载畜折算",
    desc: analysisDone.value ? "载畜压力折算" : "等待折算",
    state: analysisRunning.value ? "active" : analysisDone.value ? "done" : "disabled",
  },
  {
    key: "balance",
    index: "04",
    name: "平衡判定",
    desc: analysisDone.value ? activeDerived.value.risk.label : "等待判定",
    state: analysisDone.value ? "done" : "disabled",
  },
])

const activeAdviceRows = computed(() => analysisDone.value ? splitAdvice(activeBalance.value, activeDerived.value.risk) : [])

function updateScreenViewportHeight() {
  screenViewportHeight.value = typeof window === "undefined" ? 1080 : window.innerHeight
}

onMounted(() => {
  updateScreenViewportHeight()
  window.addEventListener("resize", updateScreenViewportHeight)
  emit("loading-progress", { progress: 100 })
  emit("map-ready")
  loadVillageTargets()
})

onBeforeUnmount(() => {
  destroyed = true
  window.removeEventListener("resize", updateScreenViewportHeight)
  requestSerial += 1
  villageLoadSerial += 1
  clearAnalysisTimer()
})

watch(
  () => activeBalance.value?.key,
  () => {
    analysisState.value = "idle"
    analysisProgress.value = 0
    processStageIndex.value = 0
    analysisError.value = ""
    activeAnalysisRequest = null
    clearAnalysisTimer()
  }
)

watch(
  () => props.active,
  (active) => {
    if (active || !analysisRunning.value) return
    analysisState.value = "idle"
    analysisProgress.value = 0
    processStageIndex.value = 0
    analysisError.value = ""
    activeAnalysisRequest = null
    clearAnalysisTimer()
  },
)

function handleScopeChange(scopeKey) {
  activeScope.value = scopeKey
  activeKey.value = ""
  analysisState.value = "idle"
  analysisError.value = ""
}

function selectBalance(row) {
  if (!row) return
  activeScope.value = ["county", "town", "village"].includes(row.type) ? row.type : "county"
  activeKey.value = row.key
  analysisState.value = "idle"
  analysisError.value = ""
}

function startAnalysis() {
  if (!props.active || !activeBalance.value || analysisRunning.value) return
  analysisState.value = "running"
  analysisProgress.value = 0
  processStageIndex.value = 0
  analysisError.value = ""
  clearAnalysisTimer()
  const startedAt = Date.now()
  let requestFailed = false
  const analysisRequest = refreshActiveBalance().catch((error) => {
    requestFailed = true
    analysisError.value = error?.message || "未查询到该对象的草畜平衡结果"
    return null
  })
  activeAnalysisRequest = analysisRequest
  analysisTimer = window.setInterval(() => {
    if (destroyed) return
    const maxProgress = activeAnalysisRequest === analysisRequest ? 92 : 100
    analysisProgress.value = Math.min(maxProgress, analysisProgress.value + 2)
    processStageIndex.value = Math.min(
      analysisProcessRows.value.length - 1,
      Math.floor(analysisProgress.value / 25)
    )
  }, 140)
  analysisRequest.finally(async () => {
    const remaining = MIN_ANALYSIS_DURATION - (Date.now() - startedAt)
    if (remaining > 0) {
      await new Promise((resolve) => window.setTimeout(resolve, remaining))
    }
    if (destroyed || analysisState.value !== "running" || activeAnalysisRequest !== analysisRequest) return
    activeAnalysisRequest = null
    clearAnalysisTimer()
    if (requestFailed || !apiResults.value[activeBalance.value?.key]) {
      analysisProgress.value = 0
      processStageIndex.value = 0
      analysisState.value = "idle"
      return
    }
    analysisProgress.value = 100
    processStageIndex.value = analysisProcessRows.value.length - 1
    analysisState.value = "done"
  })
}

async function refreshActiveBalance() {
  const row = activeBalance.value
  if (!row) throw new Error("请先选择具体核算对象")
  if (apiResults.value[row.key]) return apiResults.value[row.key]
  const requestId = ++requestSerial
  const result = await getBalanceAdvice({
    areaCode: row.areaCode,
  })
  if (destroyed || requestId !== requestSerial) return null
  if (!result || typeof result !== "object" || !Object.keys(result).length) {
    throw new Error("未查询到该对象的草畜平衡结果")
  }
  apiResults.value = {
    ...apiResults.value,
    [row.key]: result,
  }
  return result
}

async function loadVillageTargets() {
  const loadId = ++villageLoadSerial
  const towns = townRows.value
    .filter((row) => row?.areaCode)
    .map((row) => ({ ...row }))
  if (!towns.length) return

  try {
    const townVillageRows = await Promise.all(towns.map(async (town) => {
      try {
        const rows = await getAreaChildren(town.areaCode)
        if (destroyed || loadId !== villageLoadSerial) return []
        return buildVillageRows(rows, town)
      } catch (error) {
        return []
      }
    }))
    if (destroyed || loadId !== villageLoadSerial) return
    villageTargetRows.value = townVillageRows.flat()
  } catch (error) {
    if (destroyed || loadId !== villageLoadSerial) return
    villageTargetRows.value = []
  }
}

function buildVillageRows(rows = [], town = {}) {
  const validRows = (Array.isArray(rows) ? rows : []).filter((row) => {
    const areaCode = pickAreaCode(row)
    const name = pickAreaName(row)
    return Boolean(areaCode || name)
  })
  const count = validRows.length || 1
  const fallbackAreaRange = (toNumber(town.areaRange, 0) || 0) / count
  const fallbackYakNumber = (toNumber(town.yakNumber, 0) || 0) / count
  const pressureFactor = getTownPressureFactor(town)

  return validRows
    .map((row, index) => buildVillageRow(row, index, town, {
      areaRange: fallbackAreaRange,
      yakNumber: fallbackYakNumber,
      pressureFactor,
    }))
    .filter(Boolean)
}

function buildVillageRow(row = {}, index = 0, town = {}, fallback = {}) {
  const areaCode = pickAreaCode(row)
  const name = pickAreaName(row) || (areaCode ? `村级区划${areaCode}` : "")
  if (!areaCode && !name) return null
  const areaRange = toNumber(pickValue(row, [
    "areaRange",
    "area_range",
    "grasslandArea",
    "grassland_area",
    "acreage",
    "area",
  ]), fallback.areaRange)
  const yakNumber = toNumber(pickValue(row, [
    "yakNumber",
    "yak_number",
    "number",
    "yakCount",
    "yak_count",
    "livestockCount",
    "livestock_count",
  ]), fallback.yakNumber)

  return buildBalanceRow({
    key: `village-${areaCode || `${town.key || town.name}-${name}-${index}`}`,
    type: "village",
    name,
    areaCode,
    areaRange,
    yakNumber,
    township: town.name,
    source: row,
    pressureFactor: fallback.pressureFactor,
  })
}

function pickAreaCode(row = {}) {
  return String(pickValue(row, [
    "areaCode",
    "area_code",
    "areacode",
    "code",
    "value",
    "id",
    "areaId",
    "area_id",
  ], "") || "").trim()
}

function pickAreaName(row = {}) {
  return String(pickValue(row, [
    "areaName",
    "area_name",
    "areaname",
    "name",
    "label",
    "zoneName",
    "villageName",
    "village_name",
  ], "") || "").trim()
}

function getTownPressureFactor(town = {}) {
  const yakNumber = toNumber(town.yakNumber, 0)
  const livestockCapacity = toNumber(town.livestockCapacity, 0)
  const yakSheepUnit = yakNumber * BALANCE_CALCULATION_PARAMS.yakToSheepUnit
  const pressureFactor = yakSheepUnit ? livestockCapacity / yakSheepUnit : 1
  return Number.isFinite(pressureFactor) && pressureFactor > 0 ? pressureFactor : 1
}

function formatFixed(value, digits = 2) {
  const number = Number(value)
  if (!Number.isFinite(number)) return "--"
  return number.toFixed(digits)
}

function formatSignedNumber(value) {
  const number = Number(value) || 0
  const sign = number > 0 ? "+" : number < 0 ? "-" : ""
  return `${sign}${formatNumber(Math.abs(number))}`
}

function clearAnalysisTimer() {
  if (!analysisTimer) return
  window.clearInterval(analysisTimer)
  analysisTimer = null
}

function shouldRevealProcessStep(index) {
  return analysisDone.value || analysisRunning.value && index <= processStageIndex.value
}

function getProcessStepState(index) {
  if (index < processStageIndex.value || analysisDone.value) return "done"
  if (index === processStageIndex.value && analysisRunning.value) return "active"
  return "pending"
}
</script>

<style lang="scss">
.grass-livestock-balance {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 50% 35%, rgba(63, 235, 219, 0.16), transparent 28%),
    radial-gradient(circle at 73% 62%, rgba(255, 211, 103, 0.08), transparent 32%),
    radial-gradient(circle at 22% 78%, rgba(52, 152, 125, 0.1), transparent 30%),
    linear-gradient(135deg, #020a12 0%, #062439 50%, #03101b 100%);

  &::before,
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  &::before {
    background:
      linear-gradient(rgba(89, 233, 255, 0.018) 1px, transparent 1px),
      linear-gradient(90deg, rgba(89, 233, 255, 0.014) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(circle at 50% 47%, #000 0 48%, transparent 78%);
  }

  &::after {
    background:
      linear-gradient(112deg, transparent 0 35%, rgba(126, 251, 246, 0.055) 44%, transparent 54% 100%),
      linear-gradient(180deg, rgba(1, 7, 13, 0.18), rgba(1, 7, 13, 0.58));
    mix-blend-mode: screen;
    opacity: 0.78;
  }
}

.balance-backdrop {
  position: absolute;
  left: 50%;
  top: 104px;
  z-index: 1;
  width: 1740px;
  height: 944px;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(126, 251, 246, 0.16), transparent 34%),
    linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.045), rgba(255, 215, 108, 0.026), transparent),
    linear-gradient(rgba(48, 220, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 220, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 42px 42px, 42px 42px;
  mask-image: linear-gradient(180deg, transparent, #000 8%, #000 92%, transparent);

  &::before,
  &::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.5), rgba(255, 215, 108, 0.34), transparent);
    box-shadow: 0 0 22px rgba(126, 251, 246, 0.2);
  }

  &::before {
    top: 64px;
  }

  &::after {
    bottom: 42px;
  }
}

.balance-energy-band {
  position: absolute;
  left: 96px;
  right: 96px;
  top: 108px;
  height: 460px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(36, 246, 196, 0.16), transparent 56%),
    linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.1), rgba(255, 215, 108, 0.055), transparent),
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(126, 251, 246, 0.04) 32px 33px);
  opacity: 0.78;
  transform: perspective(820px) rotateX(60deg);
  transform-origin: top;
  animation: balance-band-pulse 4.6s ease-in-out infinite;
}

.balance-orbit {
  position: absolute;
  top: 108px;
  width: 282px;
  height: 282px;
  border: 1px solid rgba(126, 251, 246, 0.08);
  border-radius: 50%;
  box-shadow:
    inset 0 0 38px rgba(126, 251, 246, 0.05),
    0 0 36px rgba(126, 251, 246, 0.04);

  &::before,
  &::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
  }

  &::before {
    inset: 22px;
    border: 1px dashed rgba(126, 251, 246, 0.08);
  }

  &::after {
    inset: 72px;
    border: 1px solid rgba(255, 215, 108, 0.05);
  }

  &.is-left {
    left: 285px;
  }

  &.is-right {
    right: 285px;
  }
}

.balance-screen {
  position: absolute;
  left: 50%;
  top: 128px;
  z-index: 4;
  display: grid;
  grid-template-columns: 326px 1310px;
  align-items: start;
  gap: 24px;
  width: 1660px;
  transform: translateX(-50%);
  pointer-events: none;
}

.balance-card {
  filter:
    drop-shadow(0 18px 28px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 24px rgba(31, 209, 220, 0.04));
  pointer-events: all;

  .m-card-hd-bg,
  .m-card-hd-zs1,
  .m-card-bd-bg > svg,
  .m-card-bd-bottom-left-arrow,
  .m-card-bd-bottom-right-arrow,
  .m-card-bd-middle-left-line,
  .m-card-bd-middle-right-line {
    opacity: 0;
  }

  .m-card-hd {
    height: 44px;
    background:
      linear-gradient(90deg, rgba(48, 220, 255, 0.2), rgba(48, 220, 255, 0.05) 44%, transparent),
      linear-gradient(180deg, rgba(12, 90, 107, 0.58), rgba(4, 28, 44, 0));
    clip-path: polygon(0 0, 154px 0, 178px 20px, 100% 20px, 100% 44px, 0 44px);

    &::before {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: 1px;
      background: linear-gradient(90deg, rgba(126, 251, 246, 0.56), rgba(255, 215, 108, 0.22), transparent 72%);
      box-shadow: 0 0 14px rgba(126, 251, 246, 0.18);
    }

    &::after {
      content: "";
      position: absolute;
      right: 18px;
      top: 10px;
      width: 168px;
      height: 8px;
      background: repeating-linear-gradient(90deg, rgba(126, 251, 246, 0.28) 0 9px, transparent 9px 15px);
      opacity: 0.58;
      transform: skewX(28deg);
    }
  }

  .m-card-bd {
    background:
      radial-gradient(circle at 50% 0, rgba(126, 251, 246, 0.075), transparent 34%),
      linear-gradient(135deg, rgba(126, 251, 246, 0.052), transparent 24%),
      linear-gradient(315deg, rgba(255, 215, 108, 0.028), transparent 32%),
      linear-gradient(180deg, rgba(4, 39, 54, 0.5), rgba(1, 16, 27, 0.58));
    clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);

    &::before {
      content: "";
      position: absolute;
      inset: 0;
      border: 1px solid rgba(48, 220, 255, 0.12);
      box-shadow:
        inset 0 0 40px rgba(48, 220, 255, 0.025),
        inset 0 0 1px rgba(126, 251, 246, 0.18);
      clip-path: inherit;
      pointer-events: none;
    }

    &::after {
      content: "";
      position: absolute;
      inset: 42px 1px 1px;
      background:
        linear-gradient(rgba(126, 251, 246, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(126, 251, 246, 0.016) 1px, transparent 1px);
      background-size: 38px 38px;
      opacity: 0.46;
      pointer-events: none;
    }
  }

  .m-card-bd-content {
    top: 44px;
    bottom: 10px;
    color: #f3feff;
  }

  .m-card-bd-bg::after {
    content: "";
    position: absolute;
    inset: 5px 6px 7px;
    pointer-events: none;
    border: 0;
    background:
      linear-gradient(140deg, rgba(32, 199, 214, 0.035), transparent 34%),
      linear-gradient(180deg, rgba(17, 72, 90, 0.025), rgba(5, 28, 42, 0.035));
  }
}

.balance-sheet-card {
  filter: none;

  .m-card-hd {
    background:
      linear-gradient(90deg, rgba(48, 220, 255, 0.18), rgba(48, 220, 255, 0.055) 36%, transparent 58%);

    &::before {
      right: 32%;
      background: linear-gradient(90deg, rgba(126, 251, 246, 0.62), rgba(255, 215, 108, 0.24), transparent);
    }

    &::after {
      display: none;
    }
  }

  .m-card-bd {
    background:
      radial-gradient(circle at 50% 43%, rgba(36, 246, 196, 0.075), transparent 30%),
      linear-gradient(180deg, rgba(6, 48, 63, 0.12), rgba(1, 13, 23, 0.16));

    &::before {
      border-color: transparent;
      box-shadow: none;
    }

    &::after {
      opacity: 0.24;
    }
  }

  .m-card-bd-bg::after {
    background: none;
  }
}

.balance-target-card {
  filter:
    drop-shadow(0 14px 24px rgba(0, 0, 0, 0.26))
    drop-shadow(0 0 16px rgba(31, 209, 220, 0.04));

  .m-card-hd {
    background:
      linear-gradient(90deg, rgba(48, 220, 255, 0.18), rgba(48, 220, 255, 0.04) 58%, transparent);

    &::before {
      right: 18%;
    }
  }

  .m-card-bd {
    background:
      radial-gradient(circle at 84% 18%, rgba(255, 215, 108, 0.08), transparent 28%),
      linear-gradient(180deg, rgba(5, 42, 56, 0.34), rgba(1, 15, 25, 0.42));

    &::before {
      border-color: rgba(48, 220, 255, 0.055);
      border-left-color: rgba(48, 220, 255, 0.16);
    }
  }

  .m-card-bd-bg::after {
    background:
      radial-gradient(circle at 82% 28%, rgba(255, 215, 108, 0.045), transparent 28%),
      linear-gradient(180deg, rgba(48, 220, 255, 0.018), transparent 44%);
  }
}

.grass-livestock-balance .m-card-hd-title {
  left: 22px !important;
  height: 44px !important;
  line-height: 38px !important;
  color: #fff !important;
  font-size: 15px !important;
  letter-spacing: 1px !important;
  background: none !important;
  -webkit-text-fill-color: #fff !important;
  font-weight: 800 !important;
  filter: brightness(1.2) contrast(1.08) !important;
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.96),
    0 0 8px rgba(255, 255, 255, 0.22) !important;
}

.balance-selector {
  display: grid;
  grid-template-rows: 40px minmax(112px, 1fr) 154px;
  gap: 16px;
  height: 100%;
  padding: 10px 10px 12px;
  box-sizing: border-box;
}

.balance-scope-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;

  button {
    position: relative;
    height: 36px;
    min-width: 0;
    border: 0;
    background:
      linear-gradient(180deg, rgba(9, 53, 69, 0.28), rgba(4, 25, 39, 0.18)),
      linear-gradient(90deg, rgba(126, 251, 246, 0.04), transparent);
    color: rgba(223, 250, 255, 0.76);
    font-size: 12px;
    cursor: pointer;
    clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;

    &::after {
      content: "";
      position: absolute;
      left: 18%;
      right: 18%;
      bottom: 4px;
      height: 1px;
      background: rgba(126, 251, 246, 0.46);
      opacity: 0;
      box-shadow: 0 0 10px rgba(126, 251, 246, 0.3);
    }
  }

  button.active,
  button:hover {
    background:
      linear-gradient(90deg, rgba(20, 122, 128, 0.5), rgba(255, 215, 108, 0.12)),
      rgba(3, 28, 39, 0.22);
    color: #fff;

    &::after {
      opacity: 1;
    }
  }
}

.balance-target-list {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;

  &::-webkit-scrollbar {
    width: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background: rgba(48, 220, 255, 0.28);
  }

  button {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    height: 42px;
    padding: 0 12px 0 15px;
    border: 0;
    background:
      linear-gradient(90deg, rgba(48, 220, 255, 0.1), transparent 66%),
      linear-gradient(180deg, rgba(8, 45, 59, 0.22), rgba(3, 20, 31, 0.12));
    color: rgba(223, 250, 255, 0.78);
    cursor: pointer;
    box-sizing: border-box;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
    transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;

    &::before {
      content: "";
      position: absolute;
      inset: 0;
      border: 0;
      border-bottom: 1px solid rgba(48, 220, 255, 0.08);
      clip-path: inherit;
      pointer-events: none;
    }

    &::after {
      content: "";
      position: absolute;
      left: 0;
      top: 9px;
      bottom: 9px;
      width: 2px;
      background: rgba(126, 251, 246, 0.38);
      opacity: 0;
    }
  }

  button:hover {
    transform: translateX(3px);
    color: #fff;

    &::before {
      border-color: rgba(126, 251, 246, 0.24);
    }
  }

  span,
  small {
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1;
  }

  span {
    font-size: 14px;
  }

  small {
    color: rgba(126, 251, 246, 0.56);
    font-size: 12px;
    text-align: right;
  }

  button.active {
    background:
      linear-gradient(90deg, rgba(255, 215, 108, 0.24), rgba(31, 122, 130, 0.46) 58%, rgba(4, 27, 42, 0.14)),
      rgba(4, 27, 42, 0.26);
    color: #fff;
    transform: translateX(5px);

    &::before {
      border-color: rgba(255, 215, 108, 0.46);
      box-shadow: inset 0 0 16px rgba(255, 215, 108, 0.1);
    }

    &::after {
      opacity: 1;
      background: #ffd76c;
      box-shadow: 0 0 12px rgba(255, 215, 108, 0.38);
    }
  }
}

.balance-action-box {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 16px 16px;
  background:
    radial-gradient(circle at 90% 18%, rgba(255, 215, 108, 0.1), transparent 30%),
    linear-gradient(135deg, rgba(255, 215, 108, 0.055), transparent 42%),
    linear-gradient(180deg, rgba(4, 27, 42, 0.16), rgba(4, 27, 42, 0.08));
  box-sizing: border-box;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 0;
    border-left: 1px solid rgba(48, 220, 255, 0.13);
    border-bottom: 1px solid rgba(48, 220, 255, 0.06);
    clip-path: inherit;
    pointer-events: none;
  }

  &::after {
    content: "";
    position: absolute;
    left: 17px;
    right: 17px;
    bottom: 58px;
    height: 1px;
    background: linear-gradient(90deg, rgba(126, 251, 246, 0.38), transparent);
    pointer-events: none;
  }

  span,
  strong,
  small {
    position: relative;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1;
  }

  span,
  small {
    color: rgba(223, 250, 255, 0.64);
    font-size: 12px;
  }

  strong {
    margin-top: 8px;
    color: #fff;
    font-size: 25px;
    line-height: 32px;
    text-shadow: 0 0 16px rgba(126, 251, 246, 0.16);
  }

  small {
    margin-top: 4px;
    color: rgba(126, 251, 246, 0.72);
  }

  button {
    position: relative;
    z-index: 1;
    width: 148px;
    height: 42px;
    margin-top: 18px;
    border: 1px solid rgba(255, 215, 108, 0.38);
    background:
      linear-gradient(90deg, rgba(255, 215, 108, 0.3), rgba(48, 220, 255, 0.14)),
      rgba(4, 27, 42, 0.55);
    color: #fff;
    cursor: pointer;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    box-shadow:
      inset 0 0 16px rgba(255, 215, 108, 0.08),
      0 0 18px rgba(255, 215, 108, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow:
      inset 0 0 18px rgba(255, 215, 108, 0.12),
      0 0 22px rgba(255, 215, 108, 0.14);
  }

  button:disabled {
    cursor: default;
    opacity: 0.55;
  }
}

.balance-sheet {
  position: relative;
  height: 100%;
  padding: 8px 18px 18px;
  overflow: hidden;
  box-sizing: border-box;

  &::before {
    content: "";
    position: absolute;
    left: 22px;
    right: 22px;
    top: 9px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.45), rgba(255, 215, 108, 0.28), transparent);
    animation: balance-scan 2.8s linear infinite;
    pointer-events: none;
  }

  &::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 14px;
    height: 38%;
    background: radial-gradient(ellipse at 50% 100%, rgba(126, 251, 246, 0.14), transparent 68%);
    pointer-events: none;
  }
}

.balance-field-lines {
  position: absolute;
  inset: 86px 70px 116px;
  z-index: 0;
  pointer-events: none;

  &::before {
    content: "";
    position: absolute;
    left: 4%;
    right: 4%;
    top: 45%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.22), rgba(255, 215, 108, 0.14), rgba(126, 251, 246, 0.22), transparent);
    box-shadow: 0 0 20px rgba(126, 251, 246, 0.08);
  }

  &::after {
    content: "";
    position: absolute;
    left: 20%;
    right: 20%;
    top: 21%;
    height: 330px;
    background:
      radial-gradient(ellipse at 50% 26%, rgba(36, 246, 196, 0.14), transparent 50%),
      repeating-linear-gradient(90deg, transparent 0 42px, rgba(126, 251, 246, 0.032) 42px 43px);
    transform: perspective(700px) rotateX(58deg);
    transform-origin: top;
    opacity: 0.86;
  }

  i {
    position: absolute;
    top: 44%;
    width: 220px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.42), transparent);
    transform-origin: center;
    animation: balance-field-drift 5.2s ease-in-out infinite;
  }

  i:nth-child(1) {
    left: 12%;
    transform: rotate(-16deg);
  }

  i:nth-child(2) {
    left: 42%;
    width: 280px;
    animation-delay: -1.4s;
  }

  i:nth-child(3) {
    right: 11%;
    transform: rotate(16deg);
    animation-delay: -2.6s;
  }
}

.balance-waiting,
.balance-running {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 86px;
  gap: 22px;
  height: 100%;
  text-align: center;
}

.balance-wait-core {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 20px;

  &::before {
    content: "";
    position: absolute;
    width: 760px;
    height: 330px;
    background:
      radial-gradient(ellipse at 50% 38%, rgba(36, 246, 196, 0.2), transparent 52%),
      linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.1), transparent),
      repeating-linear-gradient(90deg, transparent 0 34px, rgba(126, 251, 246, 0.04) 34px 35px);
    transform: perspective(640px) rotateX(63deg) translateY(86px);
    transform-origin: bottom;
    pointer-events: none;
  }

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

.balance-core-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 178px;
  height: 178px;
  border-radius: 50%;
  background:
    conic-gradient(from -90deg, #24f6c4 var(--usage-angle, 0deg), rgba(48, 220, 255, 0.12) var(--usage-angle, 0deg), rgba(48, 220, 255, 0.12) 360deg);
  box-shadow:
    0 0 34px rgba(36, 246, 196, 0.2),
    0 0 82px rgba(36, 246, 196, 0.065),
    inset 0 0 32px rgba(2, 16, 26, 0.72);

  &::before,
  &::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
  }

  &::before {
    inset: 9px;
    border: 1px solid rgba(126, 251, 246, 0.24);
    animation: balance-rotate 8s linear infinite;
    box-shadow: inset 0 0 18px rgba(126, 251, 246, 0.06);
  }

  &::after {
    inset: -10px;
    border: 1px dashed rgba(126, 251, 246, 0.18);
    animation: balance-rotate 14s linear infinite reverse;
  }

  &.is-empty {
    --usage-angle: 42deg;
    background:
      conic-gradient(from -90deg, rgba(126, 251, 246, 0.28) 0deg 42deg, rgba(48, 220, 255, 0.1) 42deg 360deg);

    .balance-core-inner strong {
      max-width: 134px;
      font-size: 30px;
      line-height: 34px;
    }
  }
}

.balance-core-inner {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(8, 48, 58, 0.9), rgba(2, 17, 27, 0.96) 68%),
    rgba(2, 17, 27, 0.92);
  text-align: center;

  span,
  strong,
  small {
    max-width: 118px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  span,
  small {
    color: rgba(223, 250, 255, 0.66);
    font-size: 12px;
  }

  strong {
    margin: 8px 0 5px;
    color: #7efbf6;
    font-family: D-DIN, Arial, sans-serif;
    font-size: 34px;
    line-height: 36px;
    text-shadow: 0 0 18px rgba(36, 246, 196, 0.35);
  }
}

.balance-waiting h2 {
  max-width: 940px;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 33px;
  line-height: 42px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-waiting p {
  max-width: 720px;
  margin: 0;
  color: rgba(223, 250, 255, 0.7);
  font-size: 15px;
  line-height: 24px;
}

.balance-preflight {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 136px minmax(0, 1fr) 148px;
  align-items: center;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;

  span {
    position: relative;
    height: 34px;
    color: rgba(223, 250, 255, 0.52);
    font-size: 13px;
    line-height: 34px;
    text-align: center;
    background: transparent;
    clip-path: none;

    &::before {
      content: "";
      position: absolute;
      left: 50%;
      top: -8px;
      width: 8px;
      height: 8px;
      border: 1px solid rgba(126, 251, 246, 0.4);
      background: rgba(6, 44, 58, 0.7);
      transform: translateX(-50%) rotate(45deg);
      box-shadow: 0 0 12px rgba(126, 251, 246, 0.1);
    }
  }

  span.active {
    color: #7efbf6;
    box-shadow: none;

    &::before {
      border-color: rgba(255, 215, 108, 0.58);
      background: rgba(255, 215, 108, 0.28);
    }
  }

  i {
    height: 1px;
    background: linear-gradient(90deg, rgba(126, 251, 246, 0.1), rgba(126, 251, 246, 0.6), rgba(255, 215, 108, 0.34));
  }
}

.balance-running {
  grid-template-rows: 238px minmax(0, 1fr);
  text-align: left;
}

.balance-running-head {
  position: relative;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  align-items: center;
  gap: 34px;
  padding: 34px 84px 22px;

  &::before {
    content: "";
    position: absolute;
    left: 64px;
    right: 64px;
    bottom: 4px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.44), rgba(255, 215, 108, 0.28), transparent);
  }
}

.balance-running-title {
  min-width: 0;

  span,
  strong,
  small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  span {
    color: rgba(126, 251, 246, 0.72);
    font-size: 16px;
  }

  strong {
    margin-top: 12px;
    color: #fff;
    font-size: 36px;
    line-height: 44px;
    text-shadow: 0 0 18px rgba(126, 251, 246, 0.14);
  }

  small {
    margin-top: 10px;
    color: rgba(255, 215, 108, 0.72);
    font-size: 16px;
  }
}

.balance-progress-line {
  position: relative;
  height: 13px;
  margin-top: 22px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(48, 220, 255, 0.1), rgba(48, 220, 255, 0.05)),
    rgba(1, 12, 21, 0.5);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);

  i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, rgba(36, 246, 196, 0.18), #24f6c4, #ffd76c);
    box-shadow: 0 0 18px rgba(36, 246, 196, 0.22);
    transition: width 0.16s linear;
  }

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
    animation: balance-flow-light 1.4s linear infinite;
  }
}

.balance-live-process {
  display: grid;
  gap: 11px;
  min-height: 0;
  padding: 0 84px 30px;
}

.balance-live-step {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 0 20px;
  background:
    linear-gradient(90deg, rgba(48, 220, 255, 0.075), transparent 48%),
    linear-gradient(180deg, rgba(6, 38, 51, 0.22), rgba(2, 20, 32, 0.08));
  opacity: 0.42;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%);
  transition: opacity 0.2s ease, transform 0.2s ease;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 0;
    border-bottom: 1px solid rgba(48, 220, 255, 0.075);
    clip-path: inherit;
    pointer-events: none;
  }

  > span {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(126, 251, 246, 0.34);
    color: rgba(126, 251, 246, 0.78);
    font-family: D-DIN, Arial, sans-serif;
    font-size: 14px;
    line-height: 30px;
    text-align: center;
  }

  div {
    min-width: 0;
  }

  strong,
  p,
  em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  strong {
    display: block;
    color: #fff;
    font-size: 15px;
  }

  p {
    margin: 7px 0 0;
    color: rgba(255, 215, 108, 0.66);
    font-size: 12px;
  }

  em {
    color: rgba(223, 250, 255, 0.62);
    font-family: D-DIN, Arial, sans-serif;
    font-size: 17px;
    font-style: normal;
    text-align: right;
  }

  &.is-active,
  &.is-done {
    opacity: 1;
  }

  &.is-active {
    transform: translateX(8px);
    background:
      linear-gradient(90deg, rgba(36, 246, 196, 0.18), rgba(255, 215, 108, 0.09), transparent 66%),
      linear-gradient(180deg, rgba(10, 58, 70, 0.56), rgba(4, 34, 48, 0.42));

    &::before {
      border-color: rgba(126, 251, 246, 0.42);
      box-shadow: inset 0 0 18px rgba(126, 251, 246, 0.1);
    }

    > span {
      background: rgba(36, 246, 196, 0.1);
      box-shadow: 0 0 18px rgba(36, 246, 196, 0.12);
    }
  }

  &.is-done em,
  &.is-active em {
    color: #7efbf6;
  }
}

.balance-analysis {
  display: grid;
  position: relative;
  z-index: 1;
  grid-template-rows: 214px 108px minmax(0, 1fr);
  gap: 15px;
  height: 100%;
}

.balance-dashboard {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 0;
  padding: 18px 26px;
  background:
    radial-gradient(circle at 50% 50%, rgba(36, 246, 196, 0.2), transparent 36%),
    radial-gradient(ellipse at 50% 100%, rgba(48, 220, 255, 0.1), transparent 58%),
    linear-gradient(90deg, rgba(48, 220, 255, 0.07), rgba(2, 18, 30, 0.1) 48%, rgba(255, 215, 108, 0.055));
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 28px 100%, 0 calc(100% - 28px));

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 0;
    border-top: 1px solid rgba(48, 220, 255, 0.12);
    border-bottom: 1px solid rgba(48, 220, 255, 0.08);
    box-shadow: inset 0 0 34px rgba(36, 246, 196, 0.035);
    clip-path: inherit;
    pointer-events: none;
  }

  &::after {
    content: "";
    position: absolute;
    left: 246px;
    right: 246px;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(126, 251, 246, 0.42), rgba(255, 215, 108, 0.34), transparent);
    pointer-events: none;
  }
}

.balance-dashboard > * {
  position: relative;
  z-index: 1;
}

.balance-object-block,
.balance-verdict-card {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 18px 22px;
  background:
    radial-gradient(circle at 16% 0, rgba(126, 251, 246, 0.12), transparent 38%),
    linear-gradient(135deg, rgba(126, 251, 246, 0.075), transparent 50%),
    rgba(2, 21, 33, 0.2);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);

  &::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(126, 251, 246, 0.5), transparent);
  }
}

.balance-object-block span,
.balance-object-block strong,
.balance-object-block small,
.balance-verdict-card span,
.balance-verdict-card strong,
.balance-verdict-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-object-block span,
.balance-object-block small,
.balance-verdict-card span,
.balance-verdict-card small {
  color: rgba(223, 250, 255, 0.62);
  font-size: 12px;
}

.balance-object-block strong {
  margin-top: 8px;
  color: #fff;
  font-size: 38px;
  line-height: 44px;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.12);
}

.balance-verdict-card {
  text-align: right;

  strong {
    margin-top: 8px;
    color: #ffd76c;
    font-family: D-DIN, Arial, sans-serif;
    font-size: 38px;
    line-height: 44px;
    text-shadow: 0 0 20px rgba(255, 215, 108, 0.34);
  }

  &.is-healthy strong,
  &.is-balanced strong {
    color: #7efbf6;
  }

  &.is-danger strong {
    color: #ff8f6b;
  }
}

.balance-core {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 9px;

  &::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: -1;
    width: 332px;
    height: 118px;
    background: radial-gradient(ellipse at 50% 50%, rgba(126, 251, 246, 0.14), transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }
}

.balance-core-caption {
  color: rgba(223, 250, 255, 0.62);
  font-size: 12px;
}

.balance-compare {
  position: relative;
  display: grid;
  align-content: center;
  gap: 20px;
  padding: 17px 24px;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(126, 251, 246, 0.08), transparent 62%),
    linear-gradient(90deg, rgba(48, 220, 255, 0.08), transparent 45%, rgba(255, 215, 108, 0.065)),
    rgba(2, 21, 33, 0.16);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%);
  box-sizing: border-box;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 0;
    border-top: 1px solid rgba(48, 220, 255, 0.08);
    border-bottom: 1px solid rgba(48, 220, 255, 0.08);
    clip-path: inherit;
    pointer-events: none;
  }
}

.balance-bar-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) 190px;
  align-items: center;
  gap: 16px;
  min-width: 0;

  span {
    color: rgba(223, 250, 255, 0.72);
    font-size: 13px;
    white-space: nowrap;
  }

  div {
    position: relative;
    height: 14px;
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(48, 220, 255, 0.12), rgba(48, 220, 255, 0.06)),
      rgba(1, 12, 21, 0.56);
    clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
      transform: translateX(-100%);
      animation: balance-flow-light 2.4s linear infinite;
    }
  }

  i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, rgba(36, 246, 196, 0.2), #24f6c4);
    box-shadow: 0 0 18px rgba(36, 246, 196, 0.22);
  }

  strong {
    overflow: hidden;
    color: #fff;
    font-family: D-DIN, Arial, sans-serif;
    font-size: 23px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  em {
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.58);
    font-family: AlibabaPuHuiTi, Arial, sans-serif;
    font-size: 11px;
    font-style: normal;
  }

  &.is-livestock i {
    background: linear-gradient(90deg, rgba(255, 215, 108, 0.18), #ffd76c);
    box-shadow: 0 0 16px rgba(255, 215, 108, 0.18);
  }
}

.balance-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.26fr) minmax(0, 0.74fr);
  gap: 15px;
  min-height: 0;
}

.balance-process,
.balance-decision {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 16px 18px 15px;
  background:
    radial-gradient(circle at 18% 0, rgba(126, 251, 246, 0.11), transparent 30%),
    linear-gradient(135deg, rgba(48, 220, 255, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(255, 215, 108, 0.038), transparent 42%),
    rgba(2, 21, 33, 0.16);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  box-sizing: border-box;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 0;
    border-top: 1px solid rgba(48, 220, 255, 0.08);
    clip-path: inherit;
    pointer-events: none;
  }

  &::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 48px;
    height: 1px;
    background: linear-gradient(90deg, rgba(126, 251, 246, 0.32), transparent);
    pointer-events: none;
  }
}

.balance-section-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 28px;

  span {
    color: #fff;
    font-size: 16px;
    text-shadow: 0 0 12px rgba(126, 251, 246, 0.22);
  }

  small {
    color: rgba(126, 251, 246, 0.62);
    font-size: 12px;
  }
}

.balance-process {
  display: grid;
  grid-template-rows: 28px 38px repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.balance-process-track {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: center;

  &::before {
    content: "";
    position: absolute;
    left: 5%;
    right: 5%;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, rgba(126, 251, 246, 0.18), rgba(126, 251, 246, 0.5), rgba(255, 215, 108, 0.42));
  }

  span {
    position: relative;
    z-index: 1;
    height: 28px;
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(48, 220, 255, 0.12), rgba(2, 19, 31, 0.9)),
      rgba(2, 19, 31, 0.9);
    color: rgba(223, 250, 255, 0.72);
    font-size: 12px;
    line-height: 28px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  }

  .is-done,
  .is-active {
    color: #7efbf6;
    box-shadow: inset 0 0 14px rgba(126, 251, 246, 0.12);
  }
}

.balance-formula-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 14px;
  background:
    linear-gradient(90deg, rgba(48, 220, 255, 0.07), transparent 48%),
    linear-gradient(180deg, rgba(6, 37, 49, 0.22), rgba(2, 20, 32, 0.08));
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
  box-sizing: border-box;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 0;
    border-bottom: 1px solid rgba(48, 220, 255, 0.065);
    clip-path: inherit;
    pointer-events: none;
  }

  > span {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(126, 251, 246, 0.34);
    color: #7efbf6;
    font-family: D-DIN, Arial, sans-serif;
    font-size: 13px;
    line-height: 28px;
    text-align: center;
    background: rgba(36, 246, 196, 0.055);
  }

  div {
    min-width: 0;
  }

  strong,
  p,
  em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  strong {
    display: block;
    color: #fff;
    font-size: 15px;
  }

  p {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
  }

  em {
    color: #7efbf6;
    font-family: D-DIN, Arial, sans-serif;
    font-size: 21px;
    font-style: normal;
    text-align: right;
  }
}

.balance-decision {
  display: grid;
  grid-template-rows: 28px 112px minmax(0, 1fr);
  gap: 12px;
}

.balance-conclusion {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 16px 14px;
  background:
    radial-gradient(circle at 10% 0, rgba(255, 215, 108, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(255, 215, 108, 0.13), transparent 60%),
    rgba(74, 56, 20, 0.14);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  box-sizing: border-box;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 215, 108, 0.2);
    clip-path: inherit;
    pointer-events: none;
  }

  strong {
    position: relative;
    z-index: 1;
    display: block;
    overflow: hidden;
    color: #ffd76c;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(255, 215, 108, 0.18);
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  p {
    position: relative;
    z-index: 1;
    margin: 8px 0 0;
    overflow: hidden;
    color: rgba(236, 252, 255, 0.72);
    font-size: 12px;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.balance-advice-list {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 11px;
  min-height: 0;
  overflow: hidden;
}

.balance-advice-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  min-height: 43px;
  padding: 3px 0;

  span {
    width: 22px;
    height: 22px;
    border: 1px solid rgba(126, 251, 246, 0.44);
    color: #7efbf6;
    font-family: D-DIN, Arial, sans-serif;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
  }

  p {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: rgba(236, 252, 255, 0.82);
    font-size: 12px;
    line-height: 19px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

@keyframes balance-scan {
  0% {
    opacity: 0.2;
    transform: translateX(-28%);
  }

  50% {
    opacity: 0.8;
  }

  100% {
    opacity: 0.2;
    transform: translateX(28%);
  }
}

@keyframes balance-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes balance-flow-light {
  to {
    transform: translateX(100%);
  }
}

@keyframes balance-band-pulse {
  0%,
  100% {
    opacity: 0.56;
    filter: saturate(0.92);
  }

  50% {
    opacity: 0.86;
    filter: saturate(1.08);
  }
}

@keyframes balance-field-drift {
  0%,
  100% {
    opacity: 0.18;
    transform: translateX(-18px);
  }

  50% {
    opacity: 0.58;
    transform: translateX(18px);
  }
}

.grass-livestock-balance {
  background:
    linear-gradient(rgba(31, 169, 190, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 169, 190, 0.022) 1px, transparent 1px),
    radial-gradient(circle at 50% 35%, rgba(35, 128, 133, 0.1), transparent 34%),
    linear-gradient(135deg, #020b13 0%, #061d2b 48%, #020b13 100%);
  background-size: 44px 44px, 44px 44px, 100% 100%, 100% 100%;

  &::before,
  &::after {
    opacity: 0.26;
  }
}

.balance-backdrop {
  top: 104px;
  height: 944px;
  background:
    linear-gradient(rgba(48, 220, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 220, 255, 0.016) 1px, transparent 1px);
  background-size: 44px 44px;

  &::before,
  &::after {
    opacity: 0.32;
  }
}

.balance-orbit,
.balance-energy-band,
.balance-field-lines,
.balance-wait-core::before,
.balance-core::before {
  display: none;
}

.balance-screen {
  top: 128px;
}

.balance-card {
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.28));

  .m-card-hd {
    background:
      linear-gradient(90deg, rgba(24, 117, 135, 0.78), rgba(12, 65, 83, 0.52) 56%, rgba(6, 32, 46, 0.08));

    &::before {
      background: linear-gradient(90deg, #30dcff, rgba(126, 251, 246, 0.36), transparent 76%);
      box-shadow: none;
    }
  }

  .m-card-bd {
    background:
      linear-gradient(180deg, rgba(8, 49, 64, 0.92), rgba(3, 23, 36, 0.92));

    &::before {
      border-color: rgba(48, 220, 255, 0.2);
      box-shadow: inset 0 0 0 1px rgba(126, 251, 246, 0.04);
    }

    &::after {
      opacity: 0.22;
    }
  }
}

.balance-sheet-card {
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.24));

  .m-card-bd {
    background:
      linear-gradient(180deg, rgba(7, 43, 58, 0.92), rgba(2, 19, 31, 0.94));

    &::before {
      border-color: rgba(48, 220, 255, 0.18);
      border-left-color: rgba(48, 220, 255, 0.28);
      border-bottom-color: rgba(48, 220, 255, 0.12);
      box-shadow: inset 0 0 0 1px rgba(126, 251, 246, 0.035);
    }
  }
}

.balance-target-card {
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.26));

  .m-card-bd {
    background:
      linear-gradient(180deg, rgba(7, 45, 58, 0.9), rgba(2, 20, 32, 0.92));

    &::before {
      border-color: rgba(48, 220, 255, 0.16);
      border-left-color: rgba(48, 220, 255, 0.28);
    }
  }
}

.balance-selector {
  grid-template-rows: 40px minmax(0, 1fr) 158px;
  gap: 12px;
  padding: 12px 12px 14px;
}

.balance-scope-tabs button {
  border: 1px solid rgba(48, 220, 255, 0.12);
  background: rgba(4, 31, 44, 0.58);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.balance-scope-tabs button.active,
.balance-scope-tabs button:hover {
  background: linear-gradient(180deg, rgba(19, 98, 112, 0.9), rgba(7, 56, 76, 0.86));
}

.balance-target-list button {
  background: rgba(5, 39, 53, 0.72);

  &::before {
    border: 1px solid rgba(48, 220, 255, 0.1);
    border-left-color: rgba(48, 220, 255, 0.2);
  }
}

.balance-target-list button.active {
  background: linear-gradient(90deg, rgba(119, 98, 38, 0.9), rgba(7, 70, 77, 0.86));
}

.balance-action-box {
  background: rgba(3, 28, 40, 0.84);

  &::before {
    border: 1px solid rgba(48, 220, 255, 0.14);
  }
}

.balance-sheet {
  padding: 14px 22px 20px;

  &::before,
  &::after {
    display: none;
  }
}

.balance-waiting {
  grid-template-rows: minmax(0, 1fr) 78px;
}

.balance-wait-core {
  gap: 18px;
  padding-top: 16px;
}

.balance-core-ring {
  width: 164px;
  height: 164px;
  box-shadow:
    0 0 18px rgba(36, 246, 196, 0.12),
    inset 0 0 28px rgba(2, 16, 26, 0.74);

  &::after {
    opacity: 0.36;
  }
}

.balance-core-inner {
  width: 126px;
  height: 126px;

  strong {
    font-size: 30px;
    line-height: 34px;
    text-shadow: none;
  }
}

.balance-preflight span {
  background: rgba(4, 32, 45, 0.78);
  border: 1px solid rgba(48, 220, 255, 0.1);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);

  &::before {
    display: none;
  }
}

.balance-running-head {
  padding: 30px 58px 18px;
}

.balance-live-process {
  padding: 0 58px 26px;
}

.balance-live-step {
  background: rgba(5, 36, 50, 0.76);

  &::before {
    border: 1px solid rgba(48, 220, 255, 0.08);
  }

  &.is-active {
    background: linear-gradient(90deg, rgba(22, 108, 104, 0.82), rgba(7, 53, 66, 0.86));
  }
}

.balance-analysis {
  grid-template-rows: 188px 94px minmax(0, 1fr);
  gap: 12px;
}

.balance-dashboard,
.balance-compare,
.balance-process,
.balance-decision {
  background: linear-gradient(180deg, rgba(7, 48, 62, 0.9), rgba(3, 28, 42, 0.9));
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);

  &::before {
    border: 1px solid rgba(48, 220, 255, 0.12);
    box-shadow: none;
  }
}

.balance-dashboard {
  grid-template-columns: minmax(0, 1fr) 230px minmax(0, 1fr);
  padding: 14px 20px;

  &::after {
    display: none;
  }
}

.balance-object-block,
.balance-verdict-card {
  background: rgba(4, 31, 44, 0.82);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}

.balance-object-block strong,
.balance-verdict-card strong {
  font-size: 34px;
  line-height: 40px;
  text-shadow: none;
}

.balance-verdict-card strong,
.balance-core-inner strong,
.balance-formula-row em,
.balance-bar-row i {
  text-shadow: none;
  box-shadow: none;
}

.balance-core-ring::before,
.balance-core-ring::after {
  animation: none;
}

.balance-dashboard .balance-core-ring {
  width: 156px;
  height: 156px;
}

.balance-dashboard .balance-core-inner {
  width: 120px;
  height: 120px;
}

.balance-compare {
  gap: 18px;
  padding: 14px 20px;
}

.balance-detail {
  gap: 12px;
}

.balance-process,
.balance-decision {
  padding: 14px 16px;
}

.balance-formula-row {
  background: rgba(4, 33, 46, 0.82);

  &::before {
    border: 1px solid rgba(48, 220, 255, 0.08);
  }
}

.balance-conclusion {
  background: rgba(70, 55, 22, 0.7);
}

.balance-bar-row div::after,
.balance-progress-line::after {
  display: none;
}

.balance-core-caption {
  color: rgba(223, 250, 255, 0.72);
}

.balance-sheet.is-ready {
  padding: 18px 22px 22px;
}

.balance-sheet.is-ready .balance-analysis {
  grid-template-rows: 158px 84px minmax(0, 1fr);
  gap: 14px;
}

.balance-sheet.is-ready .balance-dashboard {
  grid-template-columns: minmax(0, 1fr) 188px minmax(0, 1fr);
  gap: 18px;
  padding: 14px 22px;
}

.balance-sheet.is-ready .balance-object-block,
.balance-sheet.is-ready .balance-verdict-card {
  min-height: 104px;
  padding: 18px 20px;
  box-sizing: border-box;
}

.balance-sheet.is-ready .balance-object-block strong,
.balance-sheet.is-ready .balance-verdict-card strong {
  margin-top: 7px;
  font-size: 28px;
  line-height: 34px;
}

.balance-sheet.is-ready .balance-object-block small,
.balance-sheet.is-ready .balance-verdict-card small {
  margin-top: 4px;
}

.balance-sheet.is-ready .balance-dashboard .balance-core-ring {
  width: 132px;
  height: 132px;
}

.balance-sheet.is-ready .balance-dashboard .balance-core-inner {
  width: 102px;
  height: 102px;
}

.balance-sheet.is-ready .balance-core-inner strong {
  max-width: 92px;
  margin: 5px 0 3px;
  font-size: 26px;
  line-height: 28px;
}

.balance-sheet.is-ready .balance-core-inner span,
.balance-sheet.is-ready .balance-core-inner small {
  max-width: 92px;
  font-size: 11px;
}

.balance-sheet.is-ready .balance-core {
  gap: 5px;
}

.balance-sheet.is-ready .balance-core-caption {
  font-size: 11px;
}

.balance-sheet.is-ready .balance-compare {
  gap: 14px;
  padding: 12px 20px;
}

.balance-sheet.is-ready .balance-bar-row {
  grid-template-columns: 92px minmax(0, 1fr) 178px;
  gap: 14px;
}

.balance-sheet.is-ready .balance-bar-row strong {
  font-size: 20px;
}

.balance-sheet.is-ready .balance-detail {
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 14px;
}

.balance-sheet.is-ready .balance-process,
.balance-sheet.is-ready .balance-decision {
  overflow: hidden;
  padding: 13px 15px;
}

.balance-sheet.is-ready .balance-process {
  grid-template-rows: 26px 32px repeat(4, minmax(58px, 1fr));
  gap: 8px;
}

.balance-sheet.is-ready .balance-decision {
  grid-template-rows: 26px 92px minmax(0, 1fr);
  gap: 10px;
}

.balance-sheet.is-ready .balance-section-title {
  height: 26px;
}

.balance-sheet.is-ready .balance-section-title span {
  font-size: 15px;
}

.balance-sheet.is-ready .balance-process-track {
  height: 32px;
}

.balance-sheet.is-ready .balance-process-track span {
  height: 26px;
  font-size: 11px;
  line-height: 26px;
}

.balance-sheet.is-ready .balance-formula-row {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  min-height: 58px;
  padding: 8px 12px;
}

.balance-sheet.is-ready .balance-formula-row > span {
  width: 27px;
  height: 27px;
  font-size: 12px;
  line-height: 25px;
}

.balance-sheet.is-ready .balance-formula-row strong {
  font-size: 14px;
}

.balance-sheet.is-ready .balance-formula-row p {
  margin-top: 3px;
  font-size: 11px;
  line-height: 16px;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.balance-sheet.is-ready .balance-conclusion {
  padding: 13px 14px;
}

.balance-sheet.is-ready .balance-conclusion strong {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.balance-sheet.is-ready .balance-conclusion p {
  margin-top: 6px;
}

.balance-sheet.is-ready .balance-advice-list {
  gap: 8px;
  overflow: hidden;
}

.balance-sheet.is-ready .balance-advice-item {
  min-height: 34px;
  padding: 1px 0;
}

.balance-sheet.is-ready .balance-advice-item p {
  line-height: 18px;
  -webkit-line-clamp: 2;
}
</style>
